As discussed earlier, plug-in development is a useful technique whenever we are going to perform a task more than once. Here we will itemize some of the components that can populate a plug-in file of our own design. Our plug-ins can use any combination of the following types of jQuery enhancements.
Add a new method to all jQuery objects created with the
jQuery.fn.methodName = methodDefinition;
When a function needs to act on one or more DOM elements, creating a new jQuery object method is usually appropriate. Object methods have access to the matched elements referenced by the jQuery object, and can inspect or manipulate them.