3

as i have just started developing plugins in jquery i am curious to know the difference between plugin based on name and plugin based on function and what is better approach to develop a plugin

Bipin Chandra Tripathi
  • 2,472
  • 3
  • 24
  • 43

1 Answers1

1

plugin based on name also called method plugin and plugin based on function also called function plugin

  1. Method plugins should always return the jQuery object (this, in the code), to allow for chainability.
  2. Function plugins do not support chainability, Method plugins do support chainability.
  3. Method plugins should always return the jQuery object (this, in the code), to allow for chainability.
  4. Method plugins extend the jQuery.fn object, Function plugins directly extends the jQuery object.