Ecommerce Developer
 
 

Code

Book Review: jQuery Cookbook Offers Solutions, Tips, Techniques

 

Every JavaScript developer uses a library. Whether that library is your own standard functions file that you bring with you to each project or a more formal library like jQuery, there are just going to be some tasks (functions) that you will repeat over and over again.

It doesn't make sense to rewrite functions that do exactly the same things each time you begin a new project. If providing basic and often used functions was all that the jQuery Library did, it would still be worthwhile. But, like most JavaScript libraries, jQuery also makes it easier to code other, less frequently used solutions, if only you knew what the library was capable of.

The jQuery Cookbook

Enter the recently published jQuery Cookbook from O'Reilly Media edited by Cody Lindley, which contains coding recipes for dozens of specific JavaScript scenarios.

Like most coding cookbooks, the jQuery Cookbook is divided into short units that address a single problem, suggest a solution, and then discuss that solution or related considerations.

cover image from the jQuery Cookbook For me, this format does two things.

First, it gives me a specific solution. For example, I love the jQuery UI Music Player recipe that starts on page 327. It provides all of the code—including HTML 5 and CSS—necessary to develop a very nice audio player that I intend to use in an upcoming project.

But the recipe also helps me to glean tips and techniques from some of jQuery's best experts. I learn by watching, if you will, Jonathan Sharp, Ariel Flesler, Karl Swedberg, Cody Lindley or other client-side developers who I admire structure their code and attack particular challenges.

In this way, the jQuery Cookbook doesn't just give me recipes to follow, it also helps me to improve my code writing overall.

Very Complete

The jQuery Cookbook is some 435 pages of recipes divided into 18 chapters, each of which contain specific examples. I could babble on about how complete the book is, but perhaps it is better to give you a few specific examples. Here are just a handful of the recipes you'll find in the book.

  • Configuring jQuery not to conflict with other libraries
  • Using jQuery for progressive enhancement (think mobile design)
  • Applying sequential effects
  • Switching stylesheets based on browser width
  • Event delegation
  • Passing dynamic data to event handlers
  • Using an object's methods as event listeners
  • Cross fading rotating images
  • Destroying a plugin and getting your element back
  • Parsing JSON
  • Converting XML to DOM
  • Dealing with AJAX and the back button
  • Testing asynchronous callbacks

Summing Up

If you code, you should own the jQuery Cookbook. It is a great reference book that, as I mentioned above, provides code-intense examples while showing you how the industry's best approach client-side challenges.

Related Articles

0 Comments

Rss-sm