Book review: jQuery in Action

by Bear Bibeault and Yehuda Katz | Published by Manning Publications

As far as I'm aware, there's a grand total of two books available on the wonderful subject of jQuery. There's Learning jQuery by Karl Swedberg and Jonathan Chaffer, which offers an excellent way to dive right in and get started creating great functionality really fast, and then there's jQuery in Action which was published just this year. Having already gotten the hang of creating basic jQuery functionality in my Drupal modules, I was very keen to take it to the next level and couldn't wait to get my hands on this book, which I'd heard provided a developer-level guide to the subject. I was not to be disappointed. Despite its title, the book goes a long way to explain the theoretical hows and the whys of jQuery instead of just the how-tos.

The authors, Bear Bibeault and Yehuda Katz, the former a veteran programmer of various languages and the latter a long-time jQuery core contributor, have done such a good job in choosing what to focus on in the book's nine chapters that it seems to emulate the jQuery library itself in its lean yet powerful discussions of the most important topics. Here is a brief overview of what the book covers:

  • Explanation of the jQuery way of doing JavaScript, the philosophy behind it and the basics of how it's done in practice
  • Selectors, the DOM and the jQuery wrapped set
  • Styling, altering and manipulation of page elements
  • Discussion of browser events and how jQuery handles them effortlessly
  • Animations and effects
  • Using jQuery's built-in utility functions for operations on objects other than wrapped sets of DOM elements
  • The jQuery plugin architecture and how to extend functionality with your own plugins
  • Everything you need to create powerful AJAX functionality with jQuery
  • A look at some of the most important jQuery plugins available: the Form Plugin, the Dimensions Plugin, the Live Query Plugin and the UI Plugin

There's also an appendix at the back entitled "JavaScript that you need to know but might not!" which covers basic but important topics such as object fundamentals, callback functions and closures.

OK, at this point I must confess: I read the book pretty much cover to cover in a matter of days, but I did leave out the chapter on animations and effects. This was only because most of what I'd already read on jQuery focused on this area - after all, this is the "sexy" side of jQuery. My goal in reading the book had been to get beyond the flashy stuff to discover the more advanced powers of jQuery that I had glimpsed while trying to make sense of other jQuery-based modules in Drupal. I had come across a lot of code that looked like insane acrobatics to me, noticing similarities in conventions, but not having a clue what, for example, the (function($){...})(jQuery) pattern or $.fn was all about. Needless to say, there were many aha! moments (not to be confused with AHAH moments - those come when you learn the joys of jQuery's .load() command ;-) as I read through the ingeniously simple and effective explanations of such ingeniously simple and effective devices.

The book is well-written, making the transfer of knowledge truly painless, and I think the clean structure and layout probably help a lot too. When more than words are required to adequately illustrate a concept, there are helpful "lab pages" provided, the source code for which is available from the publisher's website. Even without going the whole hog and testing out these resources for yourself, the illustrations and code snippets in the book do a great job of explaining the implementation of the concepts they pertain to.

All in all, this was a great read and for me a highly effective use of my time. I'd recommend it to anyone who is either starting out with jQuery, or, like I was, looking to step up their jQuery skills to the next level through gaining a deeper understanding of its power and fundamental concepts.