Dear list,

I'm not really into the code of the jQuery core so I'm not sure of how
jQuery.each() works, but I'm wondering: since jQuery.each() loops through
every element that matches the given selector is my logics right that is it
better performance wise to use static element event trigger instead of using
the each() method on all the elements?

An example for the simple-minded:

$('div').each(function(){$(this).click(function(){alert('You clicked me: ' +
this.id + '!')})})

or

<div id='blabla1' onclick="alert('You clicked me: ' + this.id + '!')"></div>
<div id='blabla2' onclick="alert('You clicked me: ' + this.id + '!')"></div>
<div id='blabla3' onclick="alert('You clicked me: ' + this.id + '!')"></div>

?

In most cases it does take more characters for the same functionality but
what are the differences in performance?

Kind regards,
-- 
Isaak Malik
Web Developer

Reply via email to