Bootstrap-Select plugin not working with time cons

2019-08-09 12:34发布

I am using bootstrap select plugin of silviomoreto. I am using it in an ASP.Net MVC application. I am using this with show tick option. The code is like this.

setTimeout(function () {
     $('#ddlSortBy').selectpicker({
                'selectedText': 'Select'                   
                }
            });

        }, 200);

The problem is that this plug is not working without settimeout method in my application. I have to attach this plugin within settimeout method and within document.ready method.

However some time when a page loading takes more that 200 ms what I find that plugin is applied to html select but clicking on item in select is not working. So I have to increase the timeout of to attach then its works. But ideally it should works once attached to a html select element.

0条回答
登录 后发表回答