Hello. Thank you for this tutorial. Is it possible to have in a same page 2 different select2 (E.g. id="categories" and "id=years") and for each of one apply a different border color or a different background color? Tried to find a way but.... :(
@@LaravelPackageTutorial I have my class and related CSS. It applies the color I want indeed but when I do not apply the $('.classCategories').select2( { multiple: true, closeOnSelect: true } ); If I don't apply the .select2, the select object is treated as a normal select object with the colors I want. If I apply the .select2(), it is in fact a multiple select object but with any border color...
@@LaravelPackageTutorial Thank you for your help. I really appreciate. But I am doing something wrong for sure: ... $(document).ready(function () { $('#classCategories').select2({ multiple: true, closeOnSelect: true }); }); ... Category 1 Category 2 Category 3 Category 4 ... CSS: .classCategories { border: 1px solid green; } ... Result: the border is not green
@@pjmorceyt follow this solution stackoverflow.com/questions/43051735/how-can-i-set-a-border-around-each-of-my-select2-select-box or stackoverflow.com/questions/51369304/select2-from-select-with-required-not-change-border-color
Thank you buddy,,, saved my day
Sometimes you need a random Indian guy to show you that you just forgot to include the stylesheet... Thanks mate! 🙂
Hello. Thank you for this tutorial. Is it possible to have in a same page 2 different select2 (E.g. id="categories" and "id=years") and for each of one apply a different border color or a different background color? Tried to find a way but.... :(
yes, you can do it. define a separate class and css
@@LaravelPackageTutorial I have my class and related CSS. It applies the color I want indeed but when I do not apply the $('.classCategories').select2(
{
multiple: true,
closeOnSelect: true
}
); If I don't apply the .select2, the select object is treated as a normal select object with the colors I want. If I apply the .select2(), it is in fact a multiple select object but with any border color...
@@pjmorceyt $('.classCategories').select2 use Id instead of class. and use class for CSS on selectbox html
@@LaravelPackageTutorial Thank you for your help. I really appreciate. But I am doing something wrong for sure: ...
$(document).ready(function () {
$('#classCategories').select2({
multiple: true,
closeOnSelect: true
});
});
...
Category 1
Category 2
Category 3
Category 4
...
CSS:
.classCategories {
border: 1px solid green;
}
...
Result: the border is not green
@@pjmorceyt follow this solution stackoverflow.com/questions/43051735/how-can-i-set-a-border-around-each-of-my-select2-select-box or stackoverflow.com/questions/51369304/select2-from-select-with-required-not-change-border-color
And if I wanted to save the Dynamic options?
Yes you ca do it
10:46