jQuery Coding Standards and Best Practices
Abhinay Rathore has compiled a treasure trove of best practices for working with jQuery (and DOM manipulation in general), and best of all it’s well-annotated with links to explanations and performance comparisons to back up the recommendations. I learned more than a few tricks to improve performance, like detaching DOM elements before engaging in heavy manipulation, using string concatenation instead of appending elements, and passing an object literal to $el.attr({attr: value})
instead of chaining multiple attr()
calls.