Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place of return statement in a jQuery plugin in code snippet | Chapter 8 Web Patterns #2

Open
imrek opened this issue Jul 29, 2016 · 0 comments

Comments

@imrek
Copy link

imrek commented Jul 29, 2016

On p. 178 your book provides an example of a jQuery plugin like this:

$.fn.yeller = function () {
    this.each(function (_, item) {
        $(item).val($(item).val().toUpperCase());
        return this;
    });
}

Shouldn't it actually return this only once after the loop (instead of every iteration) or, better yet, return this.each(), as in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant