Why not jQuery?
Why not jQuery?
I love jQuery. okay rub it. I adore, flaunt jQuery. Why?
What is jQuery?
From the jQuery website
jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.
Yes. jQuery is designed to change the way you write javascript.
So how it change the way we do javascript?
Consider the following javascript statement
document.getElementById("example");
This above returns #example as an object
So here’s the jQuery equivalent
$("#example");
get an element which has the class name example
$(".example");
select using tag names
$("input");
parent to child selector
$("p > span");
and there’s whole range of other possibilities here
Here’s AJAX handler with jQuery
response = $.ajax(
{
type: "get",
url: "report.php",
data: "var=value",
dataType: "json",
error: function(e)
{
//error handler
},
success: function(data)
{
//'data' has the server returned data
}
});
above is compatible across all browsers… Cool…!
And there’s much more than just selectors
So what are the other excitements?
There are lot more plugins, widgets like date picker, progress bar, slider, dialog windows…
You can add simple effects that supported in the core library and there is utility functions like trim (finally trim function like other languages)
Still not convinced?
- jQuery Methods and functions works in all modern browsers(count IE6 too)
- Google, Digg, Mozilla, Wordpress, Drupal, Microsoft, Nokia and much more are using this 18kb(minified and compressed version 1.3.1) library
- Can easily be integrated with tools and frameworks
And did I mention all this comes for FREE!!!!!!
Go get it; javascript is never been fun and easy like this.
“Why not jQuery?”