jquery multiSelect 多選下拉框
更新時(shí)間: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)選中項(xiàng)。
$("#id").attr("value","");//清空選中項(xiàng)。
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)選中項(xiàng)。
復(fù)制代碼 代碼如下:
$("#id").attr("value","");//清空選中項(xiàng)。
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ā)事件實(shí)例分析
- jquery及原生js獲取select下拉框選中的值示例
- jquery獲得下拉框值的代碼
- jquery動(dòng)態(tài)加載select下拉框示例代碼
- jQuery+easyui中的combobox實(shí)現(xiàn)下拉框特效
- Jquery操作下拉框(DropDownList)實(shí)現(xiàn)取值賦值
- jQuery實(shí)現(xiàn)監(jiān)聽下拉框選中內(nèi)容發(fā)生改變操作示例
- JQuery實(shí)現(xiàn)級(jí)聯(lián)下拉框效果實(shí)例講解
- jquery實(shí)現(xiàn)戶籍地選擇下拉框
相關(guān)文章
jQuery簡單實(shí)現(xiàn)點(diǎn)擊文本框復(fù)制內(nèi)容到剪貼板上的方法
這篇文章主要介紹了jQuery簡單實(shí)現(xiàn)點(diǎn)擊文本框復(fù)制內(nèi)容到剪貼板上的方法,涉及jQuery針對(duì)瀏覽器的判定與剪貼板的讀寫操作技巧,需要的朋友可以參考下2016-08-08
jQuery實(shí)現(xiàn)鼠標(biāo)移到某個(gè)對(duì)象時(shí)彈出顯示層功能
這篇文章主要介紹了jQuery實(shí)現(xiàn)鼠標(biāo)移到某個(gè)對(duì)象時(shí)彈出顯示層功能,涉及jQuery基于事件響應(yīng)動(dòng)態(tài)操作頁面元素屬性相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-08-08
jQuery實(shí)現(xiàn)批量判斷表單中文本框非空的方法(2種方法)
這篇文章主要介紹了jQuery實(shí)現(xiàn)批量判斷表單中文本框非空的方法,實(shí)例分析了2種實(shí)現(xiàn)判定非空的技巧,涉及jQuery頁面元素遍歷的相關(guān)技巧,需要的朋友可以參考下2015-12-12
jQuery zTree插件快速實(shí)現(xiàn)目錄樹
這篇文章主要為大家詳細(xì)介紹了jQuery zTree插件快速實(shí)現(xiàn)目錄樹,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-08-08
jquery實(shí)現(xiàn)奇偶行賦值不同css值
通常為了讓頁面呈現(xiàn)的更為美觀,我們喜歡在奇偶行加上不同的顏色2012-02-02
JQuery的ready函數(shù)與JS的onload的區(qū)別詳解
這篇文章主要介紹了JQuery的ready函數(shù)與JS的onload的區(qū)別,有需要的朋友可以參考一下2013-11-11

