Sunday, February 21, 2010

What is jQuery

jQuery is an amazing JavaScript library that makes it easy to create wonderful web effects in just a few lines of code. As the website says:”

“jQuery is a JavaScript library that takes this motto to heart: Writing JavaScript code should be fun. jQuery achieves this goal by taking common, repetitive, tasks, stripping out all the unnecessary markup, and leaving them short, smart and understandable.”

Maybe you are thinking… “Why I would need another JavaScript library”? Just give a try and you will see how simple and powerful it is even if you have already used Moo.fx, Scriptaculous, TW-SACK or Prototype.
Why I should use jQuery?

Simple. In just one glance at the source code of a page using jQuery you’ll see how easy it is to use, how much it accomplishes in so few lines of code, and how graceful it is.

My mind was opened one day when I stumbled across some code written with jQuery. I was flipping through the RSS feeds and reading my daily dose of web design blogs when I came across an example of JavaScript loveliness that used jQuery. Truth be told, the code on that site had some browser related bugs… but the concept was something I hadn’t seen before.
What about the code?

The code looked almost simple. Like nothing I had seen before. It made sense.

I started reading through the documentation and was amazed to see how much could be done with so little extra code.
When you can use jQuery?

You should use jQuery when you need:

* A small library that gives you powerful control over the Document Object Model
* With very little effort or work on your part

Or

* Quick access to AJAX
* Without a lot of bloat (overhead - wasted code)
* And some basic animation effects to spice things up

But…

If you need super fancy effects for animation, drag and drop, and super smooth animation then you’ll probably want to use Prototype and one of the many great library created to enhance the effects.
Where to get it?

You can download the source code (15k), a lot of plugins and read some excellent tutorials at the jQuery website. jQuery was created by John Resig.