From the course: jQuery: Creating Plugins

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Understanding how jQuery plugins are used

Understanding how jQuery plugins are used - jQuery Tutorial

From the course: jQuery: Creating Plugins

Start my 1-month free trial

Understanding how jQuery plugins are used

- Now we're going to review how jQuery plug-ins are used. I expect that you've probably used a jQuery plug-in before in a web project prior to seeing this course. But regardless, going over these concepts' important when we're thinking about how we're going to write our own plug-ins. So when somebody wants to use a plug-in, the first that they'll do is download and install it somehow. This can be referencing an external file or opening the file up and including the contained JavaScript right in the document to reduce the number of downloads and possibly make the page load faster. After that you instantiate the plug-in on a jQuery object. So this will take the form of loading up a div in jQuery, usually referenced by the dollar sign or by jQuery itself and then calling a method which is then frequently the name of the plug-in. It'll look something like that. Afterwards, you'll frequently chain on other functions and that ends up looking something like this where you first collect the…

Contents