I'm starting to learn how to create a jquery plugin where the documentation recommend me to use $.fn
For example:
$.fn.greenify = function() {
this.css( "color", "green" );
};
$( "a" ).greenify(); // Makes all the links green.
Then my question is, what is the advantage of using $.fn? Why can't I just assign a new variable to it and achieve the same result if they just want to be able to call that function like so:
var greenify = function() {
this.css( "color", "green" );
};
$( "a" ).greenify(); // Makes all the links green.