Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

How to call a jQuery plugin without specifying any elements?

While working on jQuery, I want to call a jQuery plugin, but I do not want to mention any of the elements. Is this possible to achieve in jQuery? If yes, then which jQuery method is used to call a jQuery plugin?


1 Answer
Amit D

To call a jQuery plugin without specifying any elements, use extend method. Here’s a snippet showing how to call a jQuery plugin without specifying any elements:

$.fn.extend({
  myFunction1: function(){...}
});

$.extend({
  myFunction2: function(){...}
});

Above, you can see we’re calling myFunction1 and myFunction2 without specifying any elements and using jQuery extend.

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.