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

首頁 > 開發(fā) > JS > 正文

jquery multiSelect 多選下拉框

2024-09-06 12:45:26
字體:
供稿:網(wǎng)友
$("#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 設(shè)置多選框的默認選中項。
代碼如下:
$("#id").attr("value","");//清空選中項。
var ids='1,3,6';//設(shè)置選中框ID。
var id_Ojbect=(ids).split(",");//分割為Ojbect數(shù)組。
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;//設(shè)置為選中。
}
}
}

代碼打包下載
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 册亨县| 油尖旺区| 行唐县| 孙吴县| 陆丰市| 小金县| 洛宁县| 于田县| 宜君县| 孝感市| 田东县| 拉孜县| 承德县| 永州市| 清镇市| 高密市| 临海市| 满洲里市| 朝阳县| 英超| 揭西县| 十堰市| 金秀| 菏泽市| 噶尔县| 旬阳县| 榕江县| 隆子县| 白河县| 卫辉市| 郯城县| 鹿邑县| 隆安县| 乐清市| 马公市| 应城市| 铜鼓县| 东兴市| 永春县| 淅川县| 宣威市|