The docs tell us:
Let\'s say we want to create a plugin that makes text within a set of retrieved elements green. All we have to do is add a functio
Don't we use $(el).css() to normally set CSS in jQuery?
Yes, when in the context of an element.
However in
$.fn.greenify = function() {
// 'this' is a jQuery object at this point - with all the jQuery functions
this.css( "color", "green" );
};
greenify is part of the same object that has the css function.
Somewhere else, there is a
$.fn.css = function() {
...
};
Both css and greenify are part of the prototype($.fn)
See jQuery: What's the difference between '$(this)' and 'this'? and https://remysharp.com/2007/04/12/jquerys-this-demystified