javascript - Bootstrap Multiselect Button Width Issue -


i have used multiselect of bootstrap.

my issue when select item options. if name long button width increased.

enter image description here

how handle button width after selecting options.

try using below code.

you can set max-width want in css.

javascript:

 $('#yourxyzid').multiselect({     buttontext: function(options)      {         var retstr = "";         if (options.length === 0) {            retstr = "none selected";         } else if(options.length <=3){            var textarray = [];            $.each(options,function(key,value){                textarray.push($.trim($(value).html()));            });            retstr = "<div class='pull-left restricted'>"+textarray.join(",")+"</div>";         } else {            retstr = options.length+" selected";         }         return retstr+" <b class='caret'></b>";     }  }); 

css:

.multiselect.dropdown-toggle.btn.btn-default > div.restricted {     margin-right: 5px;     max-width: 100px;     overflow: hidden; } 

Comments

Popular posts from this blog

java - Unable to make sub reports with Jasper -

scala - play framework: Modules were resolved with conflicting cross-version suffixes -

Save and close a word document by giving a name in R -