Javascript jQuery UI MultiSelect小部件无法应用于一个项目
我正在使用这个jQuery UI Multiselect小部件脚本:在asp.net中。我有一个子页面和母版页。当我默认应用此控件时,它将应用于所有Javascript jQuery UI MultiSelect小部件无法应用于一个项目,javascript,jquery,asp.net,Javascript,Jquery,Asp.net,我正在使用这个jQuery UI Multiselect小部件脚本:在asp.net中。我有一个子页面和母版页。当我默认应用此控件时,它将应用于所有dropdownlist。我想应用单个dropdownlist。有人能帮我吗 <script type="text/javascript"> $(function () { /* define global variable, and store message container
dropdownlist
。我想应用单个dropdownlist
。有人能帮我吗
<script type="text/javascript">
$(function () {
/*
define global variable,
and store message container element.
*/
var warning = $(".message");
$('select').multiselect(
{
/*
The name of the effect to use when the menu opens.
To control the speed as well, pass in an array
*/
show: ["slide", 1000],
/*
The name of the effect to use when the menu closes.
To control the speed as well, pass in an array
*/
hide: ["slide", 1000],
/*
Either a boolean value denoting whether or not to display the header,
or a string value.
If you pass a string,
the default "check all", "uncheck all", and "close"
links will be replaced with the specified text.
*/
header: "Choose only TEN items!",
/*
Fires when a checkbox is checked or unchecked,
we are using this option to restrict,
user to select no more than 3 option
*/
click: function (e) {
if ($(this).multiselect("widget").find("input:checked").length > 10) {
warning.addClass("error").removeClass("success").html("You can only check three checkboxes!");
return false;
}
else {
warning.addClass("success").removeClass("error").html("Check a few boxes.");
}
}
/*
.multiselectfilter()
Initialize filtering on any of your multiselects
by calling multiselectfilter() on the widget.
*/
}).multiselectfilter();
});
</script>
$(函数(){
/*
定义全局变量,
并存储消息容器元素。
*/
var警告=$(“.message”);
$('select')。多选(
{
/*
打开菜单时要使用的效果的名称。
若要控制速度,请以数组形式传递
*/
放映:[“幻灯片”,1000],
/*
菜单关闭时要使用的效果的名称。
若要控制速度,请以数组形式传递
*/
隐藏:[“幻灯片”,1000],
/*
表示是否显示标题的布尔值,
或字符串值。
如果你传递一个字符串,
默认的“全部选中”、“全部取消选中”和“关闭”
链接将替换为指定的文本。
*/
标题:“仅选择十项!”,
/*
选中或取消选中复选框时激发,
我们用这个选项来限制,
用户选择不超过3个选项
*/
点击:功能(e){
if($(this).multiselect(“小部件”).find(“输入:选中”).length>10){
warning.addClass(“error”).removeClass(“success”).html(“只能选中三个复选框!”);
返回false;
}
否则{
warning.addClass(“success”).removeClass(“error”).html(“选中几个框”);
}
}
/*
.multiselectfilter()
在任何多重选择上初始化筛选
通过在小部件上调用multiselectfilter()。
*/
}).multiselectfilter();
});
在$('select').multiselect()
中,当我传递我的下拉列表Id
时,此控件不起作用。只有在给出'select'
时它才起作用,同时它应用于所有下拉列表
。但是我想在一个下拉列表中申请。有人能推荐我吗?带ID的应该可以
$(document).ready(function(){
$("#example").multiselect();
});
下面的参考链接使用的是同一个插件,您可以检查您的浏览器控制台是否存在任何javascript错误吗