jquery multiSelect 多選下拉框
更新時間:2010年07月09日 00:45:15 作者:
jquery multiSelect 多選下拉框?qū)崿F(xiàn)挨罵
$("#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è)置為選中。
}
}
}
代碼打包下載
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è)置為選中。
}
}
}
代碼打包下載
您可能感興趣的文章:
- 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獲取select選中值的文本,并賦值給另一個輸入框的方法
今天小編就為大家分享一篇jquery獲取select選中值的文本,并賦值給另一個輸入框的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-08-08JQuery中如何傳遞參數(shù)如click(),change()等具體實現(xiàn)
有個需求讓兩個select中option相互轉(zhuǎn)換,這個作業(yè)就是給幾個按鈕添加click()事件接下來為大家介紹下如何在click(),change()傳遞參數(shù)2013-04-04jQuery實現(xiàn)輸入框郵箱內(nèi)容自動補全與上下翻動顯示效果【附demo源碼下載】
這篇文章主要介紹了jQuery實現(xiàn)輸入框郵箱內(nèi)容自動補全與上下翻動顯示效果,涉及jquery.autoComplete.js插件的使用,可實現(xiàn)輸入框內(nèi)容自動補全的功能,附帶了完整的demo源碼供讀者下載參考,需要的朋友可以參考下2016-09-09