How to check if a jQuery UI plugin is attached to an element?

前端 未结 5 1774
轻奢々
轻奢々 2020-12-30 07:56

How can I check to see if a jQuery UI plugin is attached to an element? For example, if I load up the .sortable widget, how can its presence be determined?

The purpo

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 08:38

    If anyone is looking for this solution in later jqueryUI versions, the data container's name of sortable plugin is now uiSortable and not sortable. Im using jQueryui 1.10

    i.e to find elements u can use

    var $elem = $('#sortable-container:data(uiSortable)');
    

    and to find elements that are NOT yet initialized

    var $elem = $('#sortable-container:not(:data(uiSortable))');
    

提交回复
热议问题