How to not over-use jQuery?

Posted by Fedyashev Nikita on Stack Overflow See other posts from Stack Overflow or by Fedyashev Nikita
Published on 2010-04-18T14:24:23Z Indexed on 2010/04/18 14:33 UTC
Read the original article Hit count: 265

Typical jQuery over-use:

$('button').click(function() {
  alert('Button clicked: ' + $(this).attr('id'));
});

Which can be simplified to:

$('button').click(function() {
  alert('Button clicked: ' + this.id);
});

Which is way faster.

Can you give me any more examples of similar jQuery over-use?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about Performance