jQuery Enlightenment is an e-book in PDF format written by Cody Lindley, an official jQuery evangelist since 2008 and talented front-end developer with over 12 years experience in the field.
The PDF format is excellent for this type of book because extra and supplemental information can be properly hyper-linked to. One of the things I loved about this book was that virtually all of the practical examples are hosted on JSBin so while reading you can instantly see the effect of code without having to download source files – everything is ready and waiting for you to experiment with.
Another thing I really found useful with this book was the level of detail it goes into when explaining the different methods found in jQuery, it even informs you how some of the methods are executed by jQuery and this gives a much fuller understanding of how the library works and therefore how to use it more effectively.
I found the book very easy to read, with a strong focus on practical code interspersed with succinct descriptions. There wasn’t too much theory or too many complex examples – the perfect blend of theory and practice. I would consider myself a fairly experienced jQuery developer, having used the library for several years, but there was still a lot I learnt from reading this book. It was really great for going back and filling in the gaps between what I’ve learnt from just playing with code, stuff I’d simply not learnt because I’d never needed to use it.
The book is divided into the following chapters:
- 1: Core jQuery
- Chapter one introduces the concept of jQuery and looks at when to include the script files, using hosted versions of the library and checking which version of the library is in use. It also covers a range of other foundation-laying subjects including the different ways of executing jQuery code, chaining, destructive vs non-destructive methods, the this keyword, aliasing the jQuery object and different wrapper-set concepts.
- 2: Selecting
- Chapter two covers advanced aspects of element selecting such as custom filters, creating custom filters, the is() method and how to escape characters used when selecting. Other topics such as stacking and nesting filters, the nth-child filter and using regular expressions to select attribute values are also covered here.
- 3: Traversing
- Chapter three looks at the different ways that new elements can be navigated to through the DOM after selection. The subtle differences between the find() and filter() methods, custom functions passed to the filter() method and how to traverse the DOM using CSS expressions with traversal methods are some of the subjects discussed here.
- 4: Manipulation
- Chapter four focuses on how raw HTML can be created, manipulated and added to the DOM. The index(), text(), contents() and remove() methods are looked at in detail and advanced techniques such as removing particular characters from an element’s content by regular expression are also discussed.
- 5: HTML forms
- Chapter five is dedicated entirely to working with HTML form elements with jQuery and covers topics including disabling and enabling elements, checking and un-checking radio and checkbox elements getting or setting the values of different form elements. The different ways of selecting form elements are looked at too.
- 6: Events
- Chapter 6 covers everything about events a jQuery developer could want to know such as working with the bind() and unbind() methods, invoking events and how to share a function between several event handlers. Other key event topics such as event namespacing, event delegation and working with the normalized event object’s native methods (such as preventDefault() are also discussed in detail.
- 7: jQuery and the browser
- This relatively short chapter looks at two ways of dealing with common tasks in the browser itself – disabling right-click context menus and handling scrolling in the browser window.
- 8: Plugins
- Chapter 8 looks at all aspects of plugins from how to construct one from scratch and best practices when working with them, to how they attach to the jquery.fn object to become new jQuery methods. Other less well known aspects of plugin development such as invoking plugins programmatically without using a collection of selected elements are also covered in detail.
- 9: Performance best practices
- 10: Effects
- Chapter eleven is concerned with the different jQuery effects and how best to leverage them. Subjects of this chapter include determining which elements are currently being animated using the :animated filter, using show(), hide() and toggle() logic without animations and the difference between sequential and non-sequential animations.
- 11: AJAX
- Chapter 11 looks at the base ajax() method from which all other AJAX methods are derived and looks in detail at cross-domain requests with JSONP and how to control caching of XHR requests.
- 12: Miscellaneous concepts
- The final chapter is a mixed bag of concepts giving some theory but mostly practical recipes for achieving different things with jQuery such as storing data on DOM elements, embedding flash objects with a plugin, pre-loading assets (images and XHR) and adding new functions to the jQuery namespace.
Overall this would be a great addition to any jQuery developer’s library and I’d thoroughly recommend it for all but the most advanced developers. Its easy readability combined with its detailed examples make this a book that I’ll repeatedly turn to for reference.