Need an additional custom class to select2-container
See original GitHub issueWe need an additional custom class to select2-container container to easily override the inner classes styles.
Like
$("#e2").select2({
customClass: "Myselectbox",
});
So that corresponding container will formed as
<div class="Myselectbox select2-container select2-container-multi">
So that I can override an inner classes like .Myselectbox .select2-choices in CSS.
Generally this will help to override the textbox(ul.select2-choices) style.
Issue Analytics
- State:
- Created 11 years ago
- Reactions:7
- Comments:18 (4 by maintainers)
Top Results From Across the Web
Add class to select2 element - jquery - Stack Overflow
I found the containerCssClass method in the documentation, but I'm not sure how to apply it. I have tried the following with no...
Read more >Add class to Select2 control — DataTables forums
How would I go about adding an additional css style to a Select2 field? I'm trying to increase the number of displayed items...
Read more >Appearance | Select2 - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
Read more >Select2 containerCssClass - CodePen
<div class="container">. 2. <label for="select2-multiple-input-sm" class="control-label">State</label>. 3. <select id="select2-multiple-input-sm" ...
Read more >Select2 and Bootstrap Integration by Keenthemes
Select2's CSS is highly customized in sass/vendors/plugins/_select2. · Select2's Javascript is globally initialized with some predefined settings in src/js/ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am using
version 4.0.2. And on usingcontainerCssClassit adds class toselect2-selection. I guess the class is supposed to be added to the main wrapperselect2-container.Or, Is there any other way to add class to the main wrapper
select2-container?@pedrofurtado – this is clearly a bug, please re-open it.
How can you set something named
containerCssClass, and have it affect the selection element and not the container element?You can add another option named
selectionCssClassto handle current use cases.