As with many areas of JavaScript, keeping track of the meaning of this is important and sometimes tricky. What does this mean at each of the two points in this custom plugin snippet?
$.fn.customPlugin = function () {
// Point 1
return this.each(function () {
// Point 2
});
};
$(document).customPlugin();