I am working with some old code that I did not write, and need some help understanding it.
(function() {
var abc = "SORocks";
$.fn[abc] = function (x) {
doSomethingCool();
};
})(jQuery)
and elsewhere in the code are statements like
(“#mydiv”).SORocks(1234);
What does the [abc] do? Is it the same as $.fn.SORocks(x)?
It is simply object notation. jQuery and jQuery.fn are objects.
Is the same as writing:
For other jQuery methods like
show()orhide()the following would work equally as well as conventional dot notation: