javascript - Bootstrap Multiselect Button Width Issue -
i have used multiselect of bootstrap.
my issue when select item options. if name long button width increased.
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
Post a Comment