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'); 

enter image description here

here instead of options want show image default.

sample image:

enter image description here

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> 

jsfiddle

furthermore can use jquery dynamically add such elements.

var span = $('<span></span>'); span.addclass('glyphicon'); span.addclass('glyphicon-pencil'); $('#foo').html(span); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -