What are the benefits of using attr() instead of using addClass() in jquery?
attr()
addClass()
.addClass() is MUCH better for performance.
.addClass()
Check out this guide to jQuery performance: http://net.tutsplus.com/tutorials/javascript-ajax/10-ways-to-instantly-increase-your-jquery-performance/
One of my favorite articles.