zoukankan      html  css  js  c++  java
  • jquery的插件选择chosen的使用

    版权声明:本文为博主原创文章,未经博主允许不得转载。http ://blog.csdn.net/jobschen/article/details/46619443

    一,文件引入

    jquery // jquery必须,且需要在chosen.js之前
    chosen.jquery.min.js //压缩版的选择核心jquery代码
    chosen.css //选择的样式文件

    二,代码示例

    1。html代码

    <select  class="chosen-select" data-placeholder="Choose a Country..." multiple> </select>
    • 1

    data-placeholder是将第一个选项留空时默认显示的内容。multiple 
    表示可以多选
    主要还是class =“chosen-select”

    2。JS代码

    $(".chosen-select").chosen({
        no_results_text: "没有找到结果!",//搜索无结果时显示的提示
        search_contains:true,   //关键字模糊搜索,设置为false,则只从开头开始匹配
        allow_single_deselect:true, //是否允许取消选择
        max_selected_options:6  //当select为多选时,最多选择个数
    });

    3。事件

     a)更改事件:

    $(".dept-select").chosen().change(function(){
        //do something...
    });

     b)当我们需要动态更新选择下的选择项时,只需在更新选择项后触发选择中的liszt:updated事件就可以了

    //...$(".dept-select").html('...<option>部门6</option>...');
    $(".dept-select").trigger("liszt:updated");

    以上只是部分选择插件的使用,更多配置属性,尽请百度...

  • 相关阅读:
    topcoder srm 320 div1
    topcoder srm 325 div1
    topcoder srm 330 div1
    topcoder srm 335 div1
    topcoder srm 340 div1
    topcoder srm 300 div1
    topcoder srm 305 div1
    topcoder srm 310 div1
    topcoder srm 315 div1
    如何统计iOS产品不同渠道的下载量?
  • 原文地址:https://www.cnblogs.com/bluealine/p/8473493.html
Copyright © 2011-2022 走看看