Hacker News new | ask | show | jobs
by experimentor 5842 days ago
I'm an okay jQuery/Javascript developer who gets stuff done - by going the way you said - search the docs for the function that I need.

I learned a lot of bad habits this way - because there are always two (or more) ways of doing things, and one of them is usually better than the rest. I just figured out that I was doing those things wrong when reading the book.

Case for example: Increasing Performance with Event Delegation - http://www.rebeccamurphey.com/jqfundamentals/#N20DAA

When I started learning jQuery, I scratched my head over this issue - I assign event handlers for a class, but they don't apply for elements that were added later to the DOM. Had the aha! moment when I figured out what was happening. The best solution I could find was to keep on assigning the event handlers whenever I added something to the DOM.

It served me well but Rebecca just taught me that there is something called $.fn.live and $.fn.delegate designed solve exactly this problem. This I would not have searched in the docs because I did'nt know that there existed something to solve this; and even if I thought there did, I might not have been able to frame the right question.

And there are lots of other gems that I picked up from this book.. jQuery really needs this. Especially for beginning developers who discover the power of jQuery - it helps them learn the right habits from the get go.

And the book is very concise and informative that the author deserves great praise for an excellent job.

Thanks, Rebecca Murphy!