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

javascript - IndexedDB error: Uncaught DataCloneError: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned -

java - Unable to make sub reports with Jasper -

Integrity error when loading fixtures for Selenium testing in Django -