Why return this.each(function()) in jQuery plugins?

When you filter elements with a selector ($('.myclass')), it can match more than only one element.
With each, you iterate over all matched elements and your code is applied to all of them.

Leave a Comment