国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery multiSelect 多選下拉框

2019-11-21 00:22:13
字體:
來源:轉載
供稿:網友
$("#id").multiSelect({ oneOrMoreSelected: '*',selectAll:false,noneSelected:'默認顯示' });
Usage: $('#id').multiSelect( options, callback )
Options: selectAll - whether or not to display the Select All option; true/false, default = true
selectAllText - text to display for selecting/unselecting all options simultaneously
noneSelected - text to display when there are no selected items in the list
oneOrMoreSelected - text to display when there are one or more selected items in the list
(note: you can use % as a placeholder for the number of items selected).
Use * to show a comma separated list of all selected; default = '% selected'
optGroupSelectable - whether or not optgroups are selectable if you use them; true/false, default = false
listHeight - the max height of the droptdown options
復制代碼 代碼如下:

// Update the textbox with the total number of selected items, and determine select all
$("#id").updateSelected()
// Update the dropdown options
$("#id").multiSelectOptionsUpdate()
// Hide the dropdown
$("#id").multiSelectOptionsHide()
// Show the dropdown
$("#id").multiSelectOptionsShow()
// get a coma-delimited list of selected values
$("#id").selectedValuesString

使用javascript 設置多選框的默認選中項。
復制代碼 代碼如下:

$("#id").attr("value","");//清空選中項。
var ids='1,3,6';//設置選中框ID。
var id_Ojbect=(ids).split(",");//分割為Ojbect數組。
var count=$("#id option").length;//獲取下拉框的長度。
for(var c=0;c<id_Ojbect.length;c++){
for(var c_i=0;c_i<count;c_i++)
{
if($("#id").get(0).options[c_i].text == id_Ojbect[c])
{
$("#id").get(0).options[c_i].selected = true;//設置為選中。
}
}
}

代碼打包下載
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 含山县| 长白| 理塘县| 揭阳市| 巴东县| 留坝县| 方城县| 北安市| 新龙县| 宁波市| 铅山县| 抚州市| 武穴市| 南丹县| 仁寿县| 彭阳县| 丹凤县| 镇雄县| 高台县| 龙川县| 含山县| 罗甸县| 伊宁市| 灵丘县| 蓬莱市| 昌江| 龙江县| 炉霍县| 永福县| 双流县| 上虞市| 固始县| 安化县| 江津市| 尤溪县| 江川县| 溧阳市| 大悟县| 仙桃市| 卫辉市| 镇远县|