Plugin methods should be automatically added to every new jQuery object that is created.
jQuery.fn same as jQuery.prototype , so the purpose of the jQuery.fn plugin jQuery.fn is to add it to the jQuery prototype, so whenever a new jQuery object is created, this method will be automatically available. Technically, this is a jQuery.fn.init object, but the idea is the same.
A jQuery call with a line like this:
$(".foo")
creates a new jQuery.fn.init object, which gets its prototype from jQuery.fn (where the plug-in methods are defined).
Here is the corresponding jQuery code that shows the creation of a new object:
source share