jquery - Select element 100% width bug if option with long text is selected (Select2 bootstrap theme) -


i using select2 bootstrap 3 theme , select2 element overflow container if option long text selected , width of element 100%.

this happens in mozilla firefox!!

i create example

.select2-container {   width: 100% !important; } 

this code affect on element overflow

span.select2-selection__rendered {   white-space: nowrap; } 

set inline style:

<select class="select2" style="width:100%"> 

comment .select2-container css:

/*.select2-container {     width: 100% !important; }*/ 

add 'element' width on select2 init:

$('.select2').select2({      width: 'element',     minimumresultsforsearch: infinity   }); }); 

example: http://jsfiddle.net/chemark/z9slqlbx/

if using bootstrap try solution instead: http://xcellerant.net/2015/09/17/fixing-the-width-of-a-select-2-with-a-long-value-in-a-bootstrap-form-group-or-input-group/


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -