作家
登录

jquery multiSelect 多选下拉框

作者: 来源:www.28hudong.com 2013-03-30 01:27:46 阅读 我要评论

$("#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 设置多选框的默认选中项。 复制代码 代码如下: $("#id").attr("value","");//清空选中项。 var ids='1,3,6';//设置选中框ID。 var id_Ojbect=(ids).split(",");//分割为Ojbect数组。 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;//设置为选中。 } } } 代码打包下载

  推荐阅读

  Javascript(AJAX)解析XML的代码(兼容FIREFOX/IE)

复制代码 代码如下: //导入js文件 function getResult(url, ready) { var xmlHttp; var r = function() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { //alert(isIE); var xmlstr; var xmldoc; >>>详细阅读


本文标题:jquery multiSelect 多选下拉框

地址:http://www.17bianji.com/kaifa2/JS/26060.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)