Book review: Learning jQuery

November 26, 2011

In this review I look at the brand new third edition of Jonathan Chaffer and Karl Swedberg’s excellent book that gives a complete introduction to the popular JavaScript library jQuery. One great thing about this edition is the foreword, written by none other than the creator of jQuery itself John Resig, which talks about the how important the community around jQuery is. It’s an inspiring start to a great book.

The book caters for beginner to advanced users of the library, with roughly the fist half of the book covering basic usage and the second half covering more advanced uses. There are also several chapters dedicated to plugins, and some excellent appendices at the end of the book. Overall this is the ideal way to learn jQuery from scratch, but users of all levels will very probably still have a look to take away from it.

One thing I like about the book is that as well as a summary at the end of the chapter, it also features a basic set of tasks that should be completed to reinforce the topics discussed, and suggested further reading on any key points.

Overal this is an excellent book that anyone interested in learning how to use the library to its full potential should read. It is packed with examples that highlight how to achieve different tasks, is highly detailed and gives lot of tips and tricks that make code more efficient or uses features of the library to their full potential.

The first chapter talks at length about what jQuery is and why it works so well. It covers how the library is used on a web page, and sets up a basic example page that is used to highlight some basic ways of using jQuery. It compares the jQuery example code with the equivalent plain JavaScript version to highlight some of the benefits of using jQuery, and looks at how Firebug can be used to aid development.

Chapter 2 covers all of the different types of selectors that can be used including simple id and class selectors, attribute selectors, and custom selectors including things like :odd, :even and the form selectors :input etc. It also talks about some of the DOM traversal methods used to access other elements after selecting an initial element.

Events are the subject of chapter 3, starting with the document ready event and the bind() method, and then on to short-hand event methods and compound events. It also covers important aspects of event handling such as event bubbling, stopping the propagation of events and event delegation. Keyboard events are also explained in detail, as well as event namespacing.

Chapter 4 is all about styling and animation. The css() method is discussed in the first section of the chapter, but the majority of the chapter is devoted to the wide range of animation methods that jQuery ships with. All of the animation methods are covered including showing and hiding, fading, sliding and positioning. It also covers the animation queue, custom animations and manipulating multiple properties simultaneously.

DOM manipulation is covered in chapter 5 including common tasks such as modifying element attributes and properties, creating new elements and inserting them, copying and moving them, and changing their structure or content.

A popular use of jQuery is in making AJAX quick and easy; chapter 6 is an extensive look at this broad topic. All of the most common AJAX tasks are discussed including working with JSON and JSONP, interacting with the server over GET and POST requests, and loading script, XML files and document fragments. It also goes into detail on other essential AJAX topics like AJAX events, error handling and setting default AJAX options.

Chapters 7 and 8 focus on jQuery plugins with chapter 7 looking at how to use some common plugins including jQuery UI. Chapter 8 looks at how to create your own plugins, including how to write jQuery UI plugins.

The latter part of the book exposes some of the more advanced aspects of each of the different components of the library that have already been looked at, witch chapters covering advanced selectors and traversing, advanced effects, advanced DOM manipulation and advanced AJAX. These latter chapters go into great detail on some of the finer aspects of using the different components.

The book ends with some useful appendices; there is one that explores JavaScript closures, another that looks at unit testing with qUnit, and a final one that briefly lists each jQuery method in a quick reference guide.

One Response to “Book review: Learning jQuery”

  1. [...] here to read the rest: Dan Wellman » Book review: Learning jQuery Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers [...]

Leave a Reply

My Books