I have select2 customized via css with its general classes and ids.
Now, I\'m trying to customize a specific class that will be provided to select2 and then apply in css
It's possible to make it in another way - via data-* of select2
- (if don't want to add select2.full.js
). Use like it:
var select2 = $(".element").select2({/* Select2 Opts */});
Ok. Now push var select2
to console ( for understanding) like:
console.log($(select2).data('select2'));
You will see something like this:
e {$element: init(1), id: "select2-....", options: e, listeners: Object, dataAdapter: d…}
$container: init(1)
$dropdown: init(1) <-- what you need!
$element: init(1)
$results: init(1)
....
Ok, now just add specified class(-es) to select2's dropdown
in the same way:
select2.data('select2').$dropdown.addClass("...");
Also, via $(select2).data('select2')
you have access to others select2 elements (container, etc.).