Code Monkey home page Code Monkey logo

yselect's Introduction

ySelect 使用方法

查看样式范例

引入常用引用

<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="css/ySelect.css" rel="stylesheet" type="text/css">

其中font-awesome是非必须的(全选图标)


html代码

<select id='m1'  multiple="multiple" >
    <option value="1">文本</option>
</select>

注意 在select中加入 multiple="multiple" ,其中<optgroup label="组"></optgroup>是被支持的.


javascript代码

你可以直接用默认模板来生成下拉
$('.demo').ySelect();
你也可以自定义参数
$('.demo1').ySelect(
    {
        placeholder: '请先选择一些项目',
        searchText: '搜索',
        showSearch: true,
        numDisplayed: 4,
        overflowText: '已选中 {n}项'
    }
);

值获取

可以便捷的取出数据组,如下
//其中参数为分隔符
$("#m1").ySelectedValues(",") // => 1,2
$("#m1").ySelectedTexts("|") // => 选中项1|选中项2

参数说明

参数名称 说明
placeholder 选择框占位符
searchText 下拉搜索占位符
showSearch 显示搜索 (true/false)
numDisplayed 超出数量整合
overflowText 超出数量整合文本提示,{n}为数量

yselect's People

Contributors

ycxyi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.