jquery multiSelect 多選下拉框
更新時間:2010年07月09日 00:45:15 作者:
jquery multiSelect 多選下拉框?qū)崿F(xiàn)挨罵
$("#id").multiSelect({ oneOrMoreSelected: '*',selectAll:false,noneSelected:'默認(rèn)顯示' });
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è)置多選框的默認(rèn)選中項。
$("#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è)置為選中。
}
}
}
代碼打包下載
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
復(fù)制代碼 代碼如下:
// 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è)置多選框的默認(rèn)選中項。
復(fù)制代碼 代碼如下:
$("#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è)置為選中。
}
}
}
代碼打包下載
您可能感興趣的文章:
- jQuery操作select下拉框的text值和value值的方法
- 基于jQuery的select下拉框選擇觸發(fā)事件實例分析
- jquery及原生js獲取select下拉框選中的值示例
- jquery獲得下拉框值的代碼
- jquery動態(tài)加載select下拉框示例代碼
- jQuery+easyui中的combobox實現(xiàn)下拉框特效
- Jquery操作下拉框(DropDownList)實現(xiàn)取值賦值
- jQuery實現(xiàn)監(jiān)聽下拉框選中內(nèi)容發(fā)生改變操作示例
- JQuery實現(xiàn)級聯(lián)下拉框效果實例講解
- jquery實現(xiàn)戶籍地選擇下拉框
相關(guān)文章
jQuery簡單實現(xiàn)點(diǎn)擊文本框復(fù)制內(nèi)容到剪貼板上的方法
這篇文章主要介紹了jQuery簡單實現(xiàn)點(diǎn)擊文本框復(fù)制內(nèi)容到剪貼板上的方法,涉及jQuery針對瀏覽器的判定與剪貼板的讀寫操作技巧,需要的朋友可以參考下2016-08-08
jQuery實現(xiàn)鼠標(biāo)移到某個對象時彈出顯示層功能
這篇文章主要介紹了jQuery實現(xiàn)鼠標(biāo)移到某個對象時彈出顯示層功能,涉及jQuery基于事件響應(yīng)動態(tài)操作頁面元素屬性相關(guān)實現(xiàn)技巧,需要的朋友可以參考下2018-08-08
jQuery實現(xiàn)批量判斷表單中文本框非空的方法(2種方法)
這篇文章主要介紹了jQuery實現(xiàn)批量判斷表單中文本框非空的方法,實例分析了2種實現(xiàn)判定非空的技巧,涉及jQuery頁面元素遍歷的相關(guān)技巧,需要的朋友可以參考下2015-12-12
JQuery的ready函數(shù)與JS的onload的區(qū)別詳解
這篇文章主要介紹了JQuery的ready函數(shù)與JS的onload的區(qū)別,有需要的朋友可以參考一下2013-11-11

