javascript - How to add label in bootstrap multiselect? -
whether have option here show image default.
code:
<select id="example-post" style="width:120px;!important;" class="footerselect" name="multiselect[]" multiple="multiple"> <option value="1">test</option> <option value="2">test1</option> <option value="3">test2 </option> </select> $('.multiselect-selected-text').text('options');
here instead of options want show image default.
sample image:
you add glyphicon within button.
<span class="glyphicon glyphicon-pencil"></span>
full example:
<div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="true"> <span class="glyphicon glyphicon-pencil"></span> <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownmenu1"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">something else here</a></li> </ul> </div>
furthermore can use jquery dynamically add such elements.
var span = $('<span></span>'); span.addclass('glyphicon'); span.addclass('glyphicon-pencil'); $('#foo').html(span);
Comments
Post a Comment