加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Bootstrap Multiselect

发布时间:2020-12-17 20:51:56 所属栏目:安全 来源:网络整理
导读:Getting Started Link the Required Files First,the?jQuery?library needs to be included. Then?Twitter Bootstrap?- both the Javascript library and the CSS stylesheet - needs to be included. !-- Include Twitter Bootstrap and jQuery: -- link re
  1. Link the Required Files

    First,the?jQuery?library needs to be included. Then?Twitter Bootstrap?- both the Javascript library and the CSS stylesheet - needs to be included.

    1. <!-- Include Twitter Bootstrap and jQuery: -->
    2. <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
    3. <script type="text/javascript" src="js/jquery.min.js"></script>
    4. <script type="text/javascript" src="js/bootstrap.min.js"></script>
    5. ?
    6. <!-- Include the plugin‘s CSS and JS: -->
    7. <script type="text/javascript" src="js/bootstrap-multiselect.js"></script>
    8. <link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css"/>

    The jQuery library can also be included using a CDN,for example the?Google CDN:

    1. <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

    Note that the plugin will work both with version 2.x of the jQuery library as well as with version 1.10.x of the jQuery library. So for using the Google CDN you may have to adjust the version.

  2. Create a Select

    Now simply use HTML to create your?select?input which you want to turn into a multiselect. Remember to set the?multipleattribute as to get a real multiselect - but do not worry,the plugin can also be used as usual select without the?multipleattribute being present.

    1. <!-- Build your select: -->
    2. <select id="example-getting-started" multiple="multiple">
    3. <option value="cheese">Cheese</option>
    4. <option value="tomatoes">Tomatoes</option>
    5. <option value="mozarella">Mozzarella</option>
    6. <option value="mushrooms">Mushrooms</option>
    7. <option value="pepperoni">Pepperoni</option>
    8. <option value="onions">Onions</option>
    9. </select>
  3. Call the Plugin

    In the end,simply call the plugin on your?select. You may also specify further options,see the Options tab for further information.

    1. <!-- Initialize the plugin: -->
    2. <script type="text/javascript">
    3. $(document).ready(function() {
    4. $(‘#example-getting-started‘).multiselect();
    5. });
    6. </script>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读