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表單驗(yàn)證實(shí)例仿Toast提示效果
這篇文章主要介紹了jquery驗(yàn)證表單仿Toast提示效果,實(shí)現(xiàn)代碼簡單易懂,非常不錯(cuò),需要的朋友可以參考下2017-03-03jQuery Easyui實(shí)現(xiàn)左右布局
jQuery EasyUI 是一個(gè)基于 jQuery 的框架,集成了各種用戶界面插件。接下來通過本文給大家介紹jQuery Easyui實(shí)現(xiàn)左右布局,涉及到到easyui左右布局相關(guān)知識(shí),感興趣的朋友一起學(xué)習(xí)吧2016-01-01jquery獲取select選中值的文本,并賦值給另一個(gè)輸入框的方法
今天小編就為大家分享一篇jquery獲取select選中值的文本,并賦值給另一個(gè)輸入框的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-08-08JQuery中如何傳遞參數(shù)如click(),change()等具體實(shí)現(xiàn)
有個(gè)需求讓兩個(gè)select中option相互轉(zhuǎn)換,這個(gè)作業(yè)就是給幾個(gè)按鈕添加click()事件接下來為大家介紹下如何在click(),change()傳遞參數(shù)2013-04-04jQuery實(shí)現(xiàn)輸入框郵箱內(nèi)容自動(dòng)補(bǔ)全與上下翻動(dòng)顯示效果【附demo源碼下載】
這篇文章主要介紹了jQuery實(shí)現(xiàn)輸入框郵箱內(nèi)容自動(dòng)補(bǔ)全與上下翻動(dòng)顯示效果,涉及jquery.autoComplete.js插件的使用,可實(shí)現(xiàn)輸入框內(nèi)容自動(dòng)補(bǔ)全的功能,附帶了完整的demo源碼供讀者下載參考,需要的朋友可以參考下2016-09-09jQuery實(shí)現(xiàn)簡單下拉導(dǎo)航效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)簡單下拉導(dǎo)航效果,通過簡單的元素遍歷與樣式替換實(shí)現(xiàn)下拉導(dǎo)航的功能,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-09-09