user2209729
user2209729

Reputation: 155

Check if jQuery Plugin has been applied to Element

In jQuery, how can I check whether a specific plugin is active on an element? Alternatively, can I get a list of which elements a specific plugin has been applied to?

I have no control of the plugin's code. I've tried checking a property like

$("#example").fancybox

but this property exists for every element, regardless of whether the plugin has been applied.

Thanks!

Upvotes: 8

Views: 3526

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262919

There is no obligation for a plugin to advertise to the outside world the fact that it has augmented an element.

That said, many plugins (including anything that uses the jQuery UI widget factory) register their names with the element using jQuery's data() facility. Then again, not all plugins do that.

Upvotes: 7

Related Questions