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 - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -