My name is Rob Cherny and I'm a professional Web Developer with 16 years of experience creating Web sites and Web-based applications. This site is where I write about my work, and random other things...

Learn More


Close Tab


  • Introduction to JavaScript with Learning jQuery Book

    Posted Aug 27, 12:32 AM
    (filed under JavaScript)

    The new book, Learning jQuery: Better Interaction Design and Web Development with Simple JavaScript Techniques is not only an excellent introduction to the jQuery library, it’s also an excellent JavaScript book. Authored by two active members of the jQuery community and that run the Learning jQuery Web site, you know you can trust the source when going through this book.

    It covers the basics of the jQuery framework, then dives into some sophisticated JavaScript concepts. These include event discussions and a slew of excellent techniques using jQuery which are actually applicable to JavaScript in general with table sorts, autocomplete, and an excellent appendix on closures.

    There is a caveat however, and it should be fairly obvious from the above discussion: the book is fairly sophisticated and may be a bit steep for those who may not know a lot of JavaScript, quite frankly. There’s a lot of great JavaScript in this book, but I would be hard pressed to recommend some of the more complex examples to someone just learning.

    The title says simple, but there’s an awful lot in this book that is not simple, particularly if you’re a beginner.

    The Contradiction of jQuery’s Audience of Users

    I’ve long been a fan of jQuery. It caught my eye since it was an enhanced selector-based library, which just seemed to make sense to me. The built-in iterators are great and the chaining syntax is real unique, almost a gimic at first glace, but when you dig under the surface, much like Simon Willison did recently, the library has a plethora of useful JavaScript tools (built in simple inheritance, looping, trim functions, etc.) and with an active plugin community, there’s much code to be had, out of the box.

    But he’s touched on the immediate contradiction of the jQuery library. It first got attention and fame due to it’s selector support (now supported by virtually every JavaScript library around) and it’s unique chaining syntax. What I’ve found is that the library appeals to beginners to JavaScript and Web designers due to how simple it makes doing some advanced tasks, and accessing these objects in a Web page with a CSS-like selector syntax.

    However, the problem is that CSS-like selector syntax is an area that a lot of hard core programmers or back-end or server-side programmers actually don’t know or understand real well. As a side note, jQuery also supports XPath style syntax for selection of DOM objects, but you tend to see those used a lot less, since the design-centric CSS audience is most common in Web design and development.

    To complete the observation, the thing is, jQuery is enormously efficient, powerful, and compact to include in pages, so where performance, extensibility, and strength of the API comes in and begins to matter, you can do incredible things with it and the library will not disappoint. But I think only a small portion of the audience of jQuery appreciates or understands this. I think that right there goes to the heart of Simon Willison’s article and commentary.

    Back to the Learning jQuery Book

    The book starts with selectors, the $() function, and moves on through events and into modern tricks of the trade in detail, with Ajax techniques and animations.

    For my tastes, it could honestly spend a bit more time on documenting the vast amount of available selectors and DOM manipulation aspects of the library, as I feel like those two parts are key to doing anything constructive with it. The examples in the online documentation only get you so far, and I often find myself trying to use the available methods in much different ways than the examples online. Maybe this feeling is just because I learn best by example, I don’t know.

    But by the third chapter it is hip deep into events, with an excellent discussion of jQuery’s very robust event support. Event support is critical to building interactive JavaScript for sure. But, I’ve found through extensive use of jQuery that I frequently still get tripped up in getting at what I need and even doing something with it, hence my comments above.

    Now, anything with an ID is easily accessed and not an issue, but where jQuery opens doors is being able to pattern match in the DOM and know with certainty you can get to any object easily, with literally a one-line statement, and do anything to it. But unlocking that can be a challenge sometimes when you get ambitious. Additionally, the DOM manipulation methods are powerful but I find obscure from time to time. Animation and Ajax effects are fairly straight-forward most of the time.

    Overall the book is well thought out and detailed, thorough with most all modern “Web 2.0” tricks and more. The book is not however a complete reference to the API’s or the definitive source necessarily for usage of the library.

    I would definitely recommend it for anyone interested in learning more about jQuery and seeing excellent examples, however I’d expect to be jumping into some deeper JavaScript code, it just so happens to using jQuery. That’s part of the other problem: are libraries really for anyone just learning? I feel someone should know how something actually works before jumping into much with libraries, but that’s because it’s in my nature to never accept anything at face value and I want to know how things work.

    The book does a great job demonstrating the jQuery library in the context of some great JavaScript, which is definitely a good thing, since the library has such a mixed audience to begin with. It’s not all child’s play, and neither should a book about it be.

  • Commenting is closed for this article.

In This Section