Book Review: jQuery 2.0 Development Cookbook (PACKT Publishing)

I was recently presented with the opportunity to review the newly published jQuery 2.0 Development Cookbook by Leon Revill (PACKT Publishing, 2014) on  In exchange, I received the book for free in electronic format from the publisher. Following is my review.

When I choose books to purchase and read, I tend to look at specific topics and the strength of the reviews associated with it. There already is a highly rated jQuery Cookbook available, published over 4 years ago, that is well reviewed. So do we really need another one? And if so, why?

Perhaps the answer is in the title, jQuery 2.0 Development Cookbook; ie, with a focus on 2.0 it is meant to be an up-to-date introduction to the implementation of common patterns addressed by jQuery. So with that context, I read this book also trying to grasp the intended audience—the book claims it is for novice to expert users of jQuery—and does it stay true to modern patterns and widely held best practices. (As a disclaimer, I was given a free copy of the book by the publisher on the promise I would provide a review).

Reading the first chapter, I found the book got off to a rough start. I found the recipes generally simplistic, and the writing to be terse to the point I had to reread some parts to understand what the author intended (as I read on in the book, I found this to be much less of an issue). One recipe in particular bothered me, perhaps more than it should. “Populating list elements” uses jQuery’s each function to iterate over a JSON array and append attributes of each element as a list item to an unordered list in the DOM. DOM manipulations are expensive, and it would have been preferable to see the unordered list built up as a document fragment, and then appended to the DOM so we only make one addition to the document in the recipe. This pattern is repeated in a subsequent recipe “Understanding pagination.”

As I started getting to the middle of the book, I thought the author was really finding his voice. It was called out in recipes to use event delegation (another best practice), though not in those words, as well to use find to select from a current set of matched elements as an optimal practice. The recipes, themselves–such as building a basic photo gallery, drag and drop functionality, accordion content slider, and so on—are useful and it’s good to understand the patterns to build them regardless of whether you use jQuery or not. I do like that the author explicitly called out recipes that could be implemented more simply with jQuery UI. If you simply need one or two of these recipes in your work, it is better to implement these yourself than to take on the bloat associated with jQuery UI. And in reflecting on it I feel this part of the book is where it earns its true value. The cost of the book is likely less than the hourly rate of anyone reading it, and will more than make up its value if you use just one of the recipes.

The latter chapters on jQuery UI and jQuery Mobile serve as basic introductions to the technologies, and may be useful if you have not worked with them before. (In the jQuery Mobile chapter, the recipes on implementing quick call and SMS functionality really are just simple capabilities introduced with HTML5 and are only tangentially related to jQuery mobile).

I would have found more useful, and I really would have liked it, if the author had gone into more advanced patterns that are becoming accepted practices with some of his recipes, in particular promises and jQuery’s deferred object. Also, jQuery 2 allows for customs builds, and an introduction to this as a recipe would have been both timely and topical, in particular since the title of this work indicates this is a recipe book built on jQuery 2.0. I suppose in that sense, the title is misleading. This book could easily have been released three or four years ago and not used jQuery 2.0 with little changed in the book.

So, to summarize. If you are newer to jQuery and the literature around it, you may find this a productive read. As an intermediate jQuery developer I think you will find the mid chapters of most value. I’m not so certain I could say this fills a niche in the market in jQuery literature that was missing, but choice isn’t necessarily a bad thing. I wish there was more new in it. Just be aware of what is in this book relative to its competitors, and choose wisely.

(3 out of 5 stars)