jQuery: Don't build websites without it!

jquery For the last few weeks I’ve been using a JavaScript library called jQuery. The more I use it, the more I wonder how I ever built websites without it! Here’s the official description:

jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.

jQuery makes all of your page manipulations easier. Best of all, it does so in a consistent, reliable way across all browsers. No more little hacks in your JavaScript to make something work in both IE and Safari.

In general, I’m a big fan of doing things client-side on the web. That might sound weird coming from an ASP.NET developer, since the whole idea behind ASP.NET’s postback model (called Web Forms) is to make everything happen server-side. I think most experienced ASP.NET developers would agree however, that the postback model is crap. It’s flawed, and if you can avoid it, you should.

We built Podcast Spot in ASP.NET, but we don’t use postbacks. ASP.NET is essentially just our rendering engine. We made use of prototype, another popular JavaScript library, but a lot of the code we wrote is just ugly. I wish I had known about jQuery back then. I’m tempted to rewrite everything using jQuery, but I’m mindful of the “if it ain’t broke, don’t fix it” adage.

It’s very unlikely I’ll be building anything new without jQuery though. That’s how much I love it! Here are my favorite things so far:

  • Works in Internet Explorer, Firefox, Safari, and Opera. Cross-browser support FTW!
  • At just 16 KB for the minified, gzipped version, it has a very small footprint.
  • The API feels natural if you already know JavaScript quite well.
  • Chainability – the magic of jQuery. If you’re familiar with object-oriented programming, you’ll love jQuery.
  • The jQuery UI API is much more consistent and complete than script.aculo.us, and the effects seem much smoother too.

To get started with jQuery, just visit the website. You’ll probably also want to take a look at jQuery UI. The documentation is excellent, and there are quite a few tutorials available online.

6 thoughts on “jQuery: Don't build websites without it!

  1. I love jQuery too, I’ve been using it for several months now. I come from doing a lot of Prototype stuff, and at first was reluctant to switch to jQuery. Prototype’s object-oriented approach felt more natural, jQuery seemed like too much “magic”.

    But after looking at it again and finally grokking the “jQuery” object, I’ll never go back. Handling events, animations, DOM manipulation — EVERYTHING — is just so elegant in jQuery.

    One final thing that I love about jQuery that you didn’t mention is the plugin architecture. It’s dead easy to write a jQuery plugin, and there are tons of awesome ones already built. The jQuery community has some of the highest-quality code I’ve seen.

  2. Great post Mack. jQuery is just as awesome as you describe. I’ll never go back either. Thanks for your positive mention of jQuery UI. We’ve tried to make it as simple and easy to use as jQuery itself.

  3. Thanks for the tip as I’ll be sure to add this along with my glyphius software to my killer apps arsenal.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s