Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 549
user2209729 Avatar asked Apr 02 '13 09:04

user2209729


1 Answers

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.

like image 110
Frédéric Hamidi Avatar answered Oct 10 '22 01:10

Frédéric Hamidi