最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to identify that Chosen plugin initialized on element - Stack Overflow

programmeradmin2浏览0评论

Is there a standard way to know that jQuery plugin already initialized at specific HTML element?

I want to make some actions if for example select element is under Chosen plugin.

Is there a standard way to know that jQuery plugin already initialized at specific HTML element?

I want to make some actions if for example select element is under Chosen plugin.

Share Improve this question edited Apr 23, 2015 at 13:34 HaveNoDisplayName 8,527106 gold badges40 silver badges50 bronze badges asked Apr 22, 2015 at 7:27 IndexIndex 7461 gold badge10 silver badges28 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 9
$("#elementId").data("chosen");

This will return the chosen object assigned to the element, or undefined if not assigned.

Note: For other plugins or JQuery versions I worked with, you may need to check the plugin name suffixed with "Obj":

$("#elementId").data("pluginNameObj");

use this $('select#elementID').attr('data-rel');
if it gives you the value "chosen" then the select element is under chosen plugin.

发布评论

评论列表(0)

  1. 暂无评论