Liking jQuery

jQuery I’m not trying to cop out of learning actual Javascript, honest. My copy of the DOM Scripting book is on its way and I’m sure I’ll learn a lot. And I like almost everything about Javascript (except the curly braces and semicolons). I still remember reading an article by Simon Willison several years ago which demonstrated techniques for standards-compliant and elegant use of Javascript. Like many who lived through The Great DHTML Frenzy circa 2000, I found this idea completely shocking at the time. Now it’s finally sinking in.

But that alone doesn’t really make me want to use Javascript. After a dozen years of working and playing at making websites my tolerance for browser quirks is just about zero. Really. One of the reasons I dove heavily into server-side programming six years ago is that I was fed up with the browser, and my allergy has only gotten worse – though the rise of web standards has been ameliorative.

Regardless of whether you think Ajax is overhyped or overused, a shift is happening. Web applications are expected to do more on the client side. End users are starting to just expect it, even if they can’t name it.

So all this is by way of explanation as to why I’ve been looking for a Javascript library. After reading the docs and example code for nearly all of the popular ones, and trying out several, I seem to be zeroing in on jQuery.

It’s not too large (60K, or 20K in packed form). It has good docs, though they’re more uneven than most would have you believe and certainly not at the level of, say, MochiKit. It has a clear focus on providing a solid core of functionality with fancier tricks delegated to plugins – and that core covers pretty much everything I’m looking for at the moment. It’s OpenAjax compliant, which I don’t care about as a practical matter but which is a good sign nonetheless. It delivers on the promise of “write less, do more.”

A decisive moment happened recently when I replaced some Ajax code I wrote using another library (the bit that refreshes my random Delicious booksmarks, at right) with one line of jQuery. The line count isn’t the most impressive part. Neither is the fact that that one line also adds a nice quick fade-out/fade-in to make the update clearer. The most impressive part is that it worked the first time.

Things never work the first time.

John Resig commented on Thu Mar 1 17:53:37 2007:

Glad to see you’re enjoying jQuery, Paul.

I was wondering if you could explain this statement a little bit more: “It has good docs, though they’re more uneven than most would have you believe and certainly not at the level of, say, MochiKit.”

We’ve been putting a lot of work into the documentation and we’d love to improve. Do you see any specific shortcomings that we can work on?

Thanks for your feedback, we appreciate it.

Paul commented on Thu Mar 1 18:06:25 2007:

Hi John! (For those who don’t know, John is the creator of jQuery.)

When I have some spare cycles, I’ll go through the docs and note some specific examples for you.

One thing that I meant to say in my post but didn’t is that you seem to be doing an excellent job of running your project. You’re clearly putting a great deal of thought and effort into it and that’s as a big a factor in open source success as clever code.

John Resig commented on Thu Mar 1 23:27:07 2007:

@Paul - That’d be fantastic. We’ve been working on a bunch of different aspects, concerning the documentation. For example, recently we moved about 20 popular tutorials over to (getting permission from the authors and mirroring all of their contents). Right now we’re starting to keep the primary docs on the wiki, but create ways of extracting the information to be used in external resources (and in alternate translations).

But yeah, documentation writing is a never-ending struggle, and your feedback and help would be greatly appreciated.

And thanks for the kind words, it’s a surprising amount of work keeping a project running. Who would’ve thought? Heh.

Karl Swedberg commented on Tue Mar 6 09:21:27 2007:

Paul, I run the blog and try to post tutorials there whenever I get a chance (many of them have been mirrored on, as John mentioned above). If you have any suggestions for tutorials that you think would be especially helpful, feel free to ping me any time.