简体   繁体   English

jQuery UI MultiSelect Widget-Cant可以应用于一项

[英]jQuery UI MultiSelect Widget-Cant able to apply in one item

I'm using this jQuery UI Multiselect Widget script: http://runnable.com/UgMdJqspu4chAAAP/how-to-create-jquery-ui-multiselect-widget in asp.net.I have one child page with master page.While i am applying this control by default its applying to all dropdownlist .I want to apply for a single Dropdownlist . 我正在使用这个jQuery UI Multiselect Widget脚本:asp.net中的http://runnable.com/Ug​​MdJqspu4chAAAP/how-to-create-jquery-ui-multiselect-widget 。我有一个包含母版页的子页。默认情况下,我正在将此控件应用于所有dropdownlist 。我想申请一个Dropdownlist Can anybody help me out? 有人可以帮我吗?

<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>

In $('select').multiselect() while i am passing my dropdown-list Id then this control is not working.Only its working while giving 'select' and simultaneously its applying to all dropdown-list . $('select').multiselect()当我传递dropdown-list Id此控件不起作用。仅在提供'select'同时起作用,并且同时将其应用于所有dropdown-list but i want to apply in one dropdown-list .Can anyone suggest me? 但我想申请一个dropdown-list 。有人可以建议我吗?

With ID it should work 使用ID应该可以工作

$(document).ready(function(){
   $("#example").multiselect();
});

Reference link below is using the same plugin, Can you check your browser console for any javascript errors ? 下面的参考链接使用的是相同的插件,您可以检查浏览器控制台是否存在任何JavaScript错误?

http://www.erichynds.com/blog/jquery-ui-multiselect-widget http://www.erichynds.com/blog/jquery-ui-multiselect-widget

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM