国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 会昌县| 洪泽县| 樟树市| 贡觉县| 鄂伦春自治旗| 屏东市| 大方县| 龙州县| 济阳县| 连城县| 玉龙| 师宗县| 平远县| 德钦县| 蒙自县| 玉溪市| 邵阳县| 万源市| 北川| 新和县| 内黄县| 阿拉善盟| 修文县| 诏安县| 安龙县| 买车| 合江县| 林西县| 获嘉县| 高安市| 论坛| 吉木乃县| 棋牌| 石阡县| 临高县| 班玛县| 林州市| 茂名市| 资中县| 元谋县| 贵定县|