0

Possible Duplicate:
How can you if check a jQuery plugin is already bound to a DOM node?

I am not sure if that exists, but is there any way to get the list of plugins that are applied on an element ?

In example. If we have the following code:

$('div').setHeightPlugin().setWidthPlugin().changeColorPlugin();

is there a way later to get the list of that plugins, that are applied on the div elements and/or remove it from the divs?

Something like

var plgs = $('div').getPlugins();
delete plgs['changeColorPlugin'];

The latest snippet, is just the basic idea.

Community
  • 1
  • 1
KodeFor.Me
  • 13,069
  • 27
  • 98
  • 166

1 Answers1

3

This is not possible as there is no universal thing marking the attachment of a plugin to an element. For example, some plugins store an instance of an internal functional object in the element's data or attributes, such as chosen which stores an instance of itself in element.data('chosen'). Some plugins don't store anything but only bind events to the element. Some of them add extra classes or attributes to plugins (like some of the jquery ui widgets). i.e. There is no single universal way in which a plugin associates with an element. Therefore a general way to achieve what you are looking for does not exist.

techfoobar
  • 65,616
  • 14
  • 114
  • 135