动态jQuery Multi Select插件

时间:2017-01-26 18:27:11

标签: javascript jquery html

我一直在尝试将此脚本安装到我的网站http://www.jqueryscript.net/form/Dynamic-jQuery-Multi-Select-Tags-Input-Plugin-Fast-Select.html 但它不能用我的代码

<head>
    <meta charset="UTF-8">
    <title>Page</title>

    <link rel="stylesheet" href="plugins/dist/fastselect.min.css">
    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="plugins/fastselect/dist/fastselect.min.js"></script>
</head>

<body>
    <select class="multipleSelect" multiple name="language">
        <option value="Bangladesh">Bangladesh</option>
        <option value="Barbados">Barbados</option>
        <option value="Belarus">Belarus</option>
        <option value="Belgium">Belgium</option>
    </select>

    <script>
        $('.multipleSelect').fastselect();
    </script>

</body>

1 个答案:

答案 0 :(得分:2)

根据doc,一种可能性是:

$('.multipleSelect').fastselect();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


<link rel="stylesheet" href="https://rawgit.com/dbrekalo/fastselect/master/dist/fastselect.min.css">
<script src="https://rawgit.com/dbrekalo/fastselect/master/dist/fastselect.standalone.min.js"></script>


<select class="multipleSelect" multiple name="language">
    <option value="Bangladesh">Bangladesh</option>
    <option value="Barbados">Barbados</option>
    <option value="Belarus">Belarus</option>
    <option value="Belgium">Belgium</option>
</select>

另一种可能性是添加 fastsearch lib

$('.multipleSelect').fastselect();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


<link rel="stylesheet" href="https://rawgit.com/dbrekalo/fastselect/master/dist/fastselect.min.css">
<script src="https://rawgit.com/dbrekalo/fastsearch/master/dist/fastsearch.min.js"></script>
<script src="https://rawgit.com/dbrekalo/fastselect/master/dist/fastselect.min.js"></script>

<select class="multipleSelect" multiple name="language">
    <option value="Bangladesh">Bangladesh</option>
    <option value="Barbados">Barbados</option>
    <option value="Belarus">Belarus</option>
    <option value="Belgium">Belgium</option>
</select>