jQuery Tidbits

June 23, 2009 | by Garrett

My experience with JavaScript has lead me to using Ajax frameworks and libraries such as Mootools, ExtJs, and now jQuery. The jQuery library has been around long enough to become stable, fast, and lightweight for dealing with those annoying problems all web application developers have to handle.

The core competency of jQuery is it’s ability to manage and manipulate the HTML DOM. This portion of the library alone makes the small 20kb library fully worth the download. Targeting an element for assignment while manipulating anything within a document is as easy as:

var element = $('#idOfTheElement')

(API for selectors)

More than just HTML document manipulation, jQuery has a very simple and clean way to implement event triggers and handlers.

// trigger
$("#idOfElement").click(function () {
   $("#idOfElementThatIsListening").trigger('click');
});
// handler
$("#idOfElementThatIsListening").bind("click", function(e){
   alert("click event happened")
});

(API for events)

This is justĀ  a taste of what jQuery can do for your web application development. I recommend giving it a test drive if you haven’t already. The online API and documentation is thorough and well constructed. The user community is chock-full of enthusiasts with useful plug-ins.

This will be my go-to JavaScript library for most applications for the foreseeable future.

Bookmark and Share

Tags: , , , , , , ,

Leave a Reply