I read about creating custom jQuery plugins and got a little confused in the sense of the following syntax:
(function($){
$.fn.truncate = function() {
return this.each(function() {
});
};
})(jQuery);
I understand that the function ($) is an anonymous function that accepts $. I just don’t quite understand why this function is enclosed in brackets and how the following brackets work with jQuery in them ....
source
share