I am working on a jQuery plugin that can be applied to multiple elements. The plugin includes some animation effects, and I need to manage the event queue based on whether the plugin is used for several elements (instead of one).
What is the best way to determine if a plugin has been applied to a single item or to multiple items?
Edit ...
Property lengthworks correctly if the plugin transferred several elements (e.g., $('.myClass').plugin()), but if the plug is caused to several individual elements (such as $('#myElem1').plugin()and $('#myElem2').plugin()), then the length returned by one for each call.
Is there a way to detect multiple instances when the plugin is used, as in the second example /
source
share