Inline javascript performance.

Posted by Geromey on Stack Overflow See other posts from Stack Overflow or by Geromey
Published on 2010-03-08T22:56:47Z Indexed on 2010/03/08 23:06 UTC
Read the original article Hit count: 280

Filed under:
|
|

I know it is better coding practice to avoid inline javascript like:

<img id="the_image" onclick="do_this(true);return false;"/>

I am thinking about switching this kind of stuff for bound jquery click events like:

$("#the_image").bind("click",function(){
     do_this(true);
     return false;
});

Will I lose any performance if I bind a ton of click events? I am not worried about the time it takes to initially bind the events, but the response times between clicking and it happening.

I bet if there is a difference, it is negligible, but I will have a ton of functions bound. I'm wondering if browsers treat the onclick attribute the same way as a bound event.

Thanks

© Stack Overflow or respective owner

Related posts about inline

Related posts about JavaScript