bootstrap multiselect 多選功能實(shí)現(xiàn)方法
官方教程
http://www.kuitao8.com/demo/20140224/1/bootstrap-multiselect-master/index.html
使用方法:
第一步引用樣式以及相關(guān)JS
<link rel="stylesheet" href="css/bootstrap.min.css" rel="external nofollow" type="text/css"/> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <!-- Include the plugin's CSS and JS: --> <script type="text/javascript" src="js/bootstrap-multiselect.js"></script> <link rel="stylesheet" href="css/bootstrap-multiselect.css" rel="external nofollow" type="text/css"/>
第二步 構(gòu)造Selection(注意 需要設(shè)置multiple屬性,否則依然是單選模式,multiple="multiple" )
<!-- Build your select: --> <select class="multiselect" multiple="multiple"> <option value="cheese">Cheese</option> <option value="tomatoes">Tomatoes</option> <option value="mozarella">Mozzarella</option> <option value="mushrooms">Mushrooms</option> <option value="pepperoni">Pepperoni</option> <option value="onions">Onions</option> </select>
第三步 初始化插件:
<script type="text/javascript"> $(document).ready(function() { $('.multiselect').multiselect(); }); </script>
常用方法:
select $('#cid').multiselect('select', arr[i]); 給控件設(shè)置選中項(xiàng)
獲取值
$('#cid').val();獲取控件所有的選中值
以上所述是小編給大家介紹的bootstrap multiselect 多選功能實(shí)現(xiàn)方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- 基于BootStrap multiselect.js實(shí)現(xiàn)的下拉框聯(lián)動(dòng)效果
- Bootstrap Multiselect 常用組件實(shí)現(xiàn)代碼
- Bootstrap 下拉多選框插件Bootstrap Multiselect
- JS組件中bootstrap multiselect兩大組件較量
- BootStrap實(shí)現(xiàn)鼠標(biāo)懸停下拉列表功能
- bootstrap下拉列表與輸入框組結(jié)合的樣式調(diào)整
- 基于BootStrap Metronic開發(fā)框架經(jīng)驗(yàn)小結(jié)【三】下拉列表Select2插件的使用
- Bootstrap每天必學(xué)之下拉菜單
- BootStrap中關(guān)于Select下拉框選擇觸發(fā)事件及擴(kuò)展
- bootstrap multiselect下拉列表功能
相關(guān)文章
用javascript代替marquee的滾動(dòng)字幕效果代碼
用javascript代替marquee的滾動(dòng)字幕效果代碼...2007-04-04JS實(shí)現(xiàn)玩轉(zhuǎn)風(fēng)車
這篇文章主要為大家詳細(xì)介紹了JS實(shí)現(xiàn)玩轉(zhuǎn)風(fēng)車,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02JavaScript實(shí)現(xiàn)指定數(shù)量的并發(fā)限制的示例代碼
這篇文章主要介紹了JavaScript實(shí)現(xiàn)指定數(shù)量的并發(fā)限制的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-03-03