Learning jQuery By PACKT Publishing

Posted October 29, 2007 at 7:00 AM by Ben Nadel

Tags: Javascript / DHTML, Books

While there are a lot of Javascript libraries out there, there's something special about jQuery. Right when you start to use it, it just feels right. Of course, trying to sell a manager or a co-worker on, "it just feels right", rarely works; it's important to be able to list out the reasons why something is good. Learning jQuery by PACKT Publishing, co-authored by Jonathan Chaffer and Karl Swedberg, does this for you - the very first chapter starts out by taking what you feel in your gut and wrapping up in 12 powerful bullet points. Not only does this set the expectations for the rest of the book (which are met with flying colors), it gives those of us who cannot easily codify our thoughts a pre-packaged strategy for introducing jQuery into the work place.


 
 
 

 
Learning jQuery by PACKT Publishing, Co-authored By Jonathan Chaffer And Karl Swedberg  
 
 
 

Having read the jQuery Reference Guide prior to this book, it is clear that Learning jQuery does not cover the entire breath of the jQuery library. It does cover a good deal of the selectors, DOM traversal and modification methods, AJAX functionality, event binding, and plug-in architecture, but to be sure, there are things that are either glossed over or left out. This should, however, not be viewed in a negative light. Instead of being incomplete, Learning jQuery takes the most important and powerful aspects of jQuery and covers them in-depth.

This book is all about the in-depth, iterative example! After every chapter, I found myself reflecting on how thorough and well done the examples were. Each one starts out with a simple piece of code (probably the way you or I would accomplish some task). Then, it adds something. Then, it factors something out. Then, it encapsulates something. Then, it adds some more functionality. At each step, I kept thinking, "Brilliant! I can't believe I never thought of doing it that way." At the end, not only do you understand the jQuery concepts in a way that the reference guide could never communicate, you've completely changed the way you want to write your own code.

I think it is very important to note that all of the code examples are done in a "progressive enhancement" way. By this, I mean that all of the examples are designed to function at some level, even for web users who have disabled Javascript in their browsers. It is only through Javascript that the advanced features are added to the page once the document object model has loaded. By "upgrading" the page functionality in this way, not only do you keep your markup very clean, you ensure that the page works for everybody. I've never even thought about doing things this way; I'm telling you, this book is inspiring.

While there is too much great content to cover on a piece by piece basis, there were many aspects that I thought were very exciting to learn about. Of particular interest is the use of CSS class values as a means for hooking into the DOM. Traditionally, I have only used CSS to format elements within the page. Many of the examples in this book use arbitrary CSS classes, not for formatting, but for targeting parts of the DOM using jQuery. For example, a column header might be given the class, "sort-asc", not because it has any formatting associated with it, but rather because it allows the sort direction of the column to be defined in a way that can be easily accessed and located via jQuery selectors. This concept really blew my mind! I had never thought about using classes for anything but formatting, but I can see how powerful this technique can be.

One of the other things that I wanted to point out is that this book describes writing jQuery code that takes place over time. That is, it explains how to write jQuery code that does not fire immediately, but rather executes several times over the course of time. I have hardly seen any documentation or examples of jQuery code that uses the setTimeout() or setIterval() methods, but this book has an example that uses these methods and explains their application quite well.

In addition to the jQuery information, just by fact of how in-depth the examples are, this book ends up teaching you more about Javascript in general. I like to think of myself as having a fairly good understanding of Javascript, and even I came across several useful functions that I had never heard of before, but am already excited about using in future projects.

This book also has the best explanation of Javascript Closures that I have ever read. In fact, they have a whole Appendix (Appendix C) dedicated to the concept of Closures. I don't know if it's just because I am at a point where I can start to understand what it is that they are, or if this book just does an excellent job of describing what they are, how they work, and how they relate to jQuery, but something about their explanation just took the concept and drove it home. So much of the power of this library is derived from the nature of Closures, so, while the understanding of Closures is not necessarily essential for the basic usage of jQuery, it is certainly essential to understand when creating complex, object-like functionality. I almost want to say, if for no other reason, you should get this book for Appendix C alone; that's the kind of eureka moment that I had when reading it.

Overall, this is a great book, and a must-read for anyone who is serious about learning how to write powerful and concise jQuery code. While the reference guide is good, it cannot hold a candle to this book in terms of teaching; in my experience, it is only through great, in-depth and iterative examples that learning can take place and Learning jQuery provides these type of examples almost in excess.




Reader Comments

Oct 29, 2007 at 10:31 AM // reply »
33 Comments

Decent review!

If you fancy learning a whole lot more about JavaScript, including closures explained brilliantly, read Pro JavaScript Techniques by John Resig (lead developer of jQuery). Fantastic book on writing professional JS. Quite an eyeopener :)


Oct 29, 2007 at 4:59 PM // reply »
11,314 Comments

@George,

Thanks a lot. I will look into that.


Oct 29, 2007 at 5:55 PM // reply »
22 Comments

Ben - I trust your recommendations and ordered a copy today. I'll let you know what I think. I've been heavily into Flex 2 development but am relooking at ajax and DTHML widgets for enhancement to some existing web pages.


Oct 29, 2007 at 6:10 PM // reply »
11,314 Comments

@Bruce,

I think you are gonna be happy with it. Some of the examples are really long (the Table chapter goes on forever!), but take your time getting through it; it will pay off.


Apr 17, 2009 at 12:09 AM // reply »
64 Comments

I have the first edition of learning JQuery ... it's a good book ... But I'm currently reading JQuery In Action by Bear Bibeaullt & Yehuda Katz and I'm learning about as much as I did with the JavaScript Bible by Danny Goodman ...

Thanks for all your incredibly effective demos Ben ...

:)

E


Apr 17, 2009 at 8:12 AM // reply »
11,314 Comments

@Edward,

I'll have to check that out - I haven't heard of it.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Jun 18, 2013 at 3:39 PM
Experimenting With The Amazon Simple Storage Service (S3) API Using ColdFusion
Hi Ben, THANKS! While not bleeding edge, it is new to me & I like learning new things every day! ... read »
Jun 18, 2013 at 12:30 PM
Disabling Auto-Correct And Auto-Capitalize Features On iPhone Inputs
Also spellcheck="false" should be mentioned as part of html5 specs ... read »
Jun 18, 2013 at 8:40 AM
Using Named Functions Within Self-Executing Function Blocks In Javascript
Hi Ben, you forgot to mention the most important thing for named self-executing functions - they can be referenced by name ONLY inside their execution context (which is parens in this case), it mean ... read »
dee
Jun 18, 2013 at 7:01 AM
My Safari Browser SQLite Database Hello World Example
hai ben, this program is really good i could understand the concept but i dint know how to save it and how to open it as you have done in the video can u give that details pls ... read »
Jun 18, 2013 at 6:04 AM
Clearing Inline CSS Properties With jQuery
Thanks a lot for for post! It helped me a lot... after being stuck since 24 hrs.. found solution from your post. Thanks again! ... read »
Jun 18, 2013 at 2:31 AM
SOTR 2013 - The Best Conference I Never Went To
I keep watching it, should keep me happily distracted until SotR14 ;) ... read »
Jun 17, 2013 at 9:45 PM
What If All User Interface (UI) Data Came In Reports?
@Jonah, As I was reading what you wrote, it occurred to me that maybe I do something similar to that in some of my client-side code. In an application I'm working on, there are a bunch of unrelated ... read »
Jun 17, 2013 at 9:36 PM
Object Thinking By David West
@Jonah, Please, don't feel bad at all. I appreciate all that you have contributed to the conversation. And, the more points of view I get, the more confident I am that I will some day, some how und ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools