<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="css/ySelect.css" rel="stylesheet" type="text/css">
其中font-awesome是
非必须的(全选图标)
<select id='m1' multiple="multiple" >
<option value="1">文本</option>
</select>
注意 在select中加入 multiple="multiple" ,其中
<optgroup label="组"></optgroup>
是被支持的.
$('.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}为数量 |