The jQuery library (available at www.jquery.com) is another library that does much more than simply Ajax communication, but at its small size (15KB), the extra features can be helpful in some situations.
4.3.1. Simple jQuery Expressions
Since jQuery relies to heavily on its querying system, it's important to first understand how it works. The function used to query the DOM is $(), which accepts a string argument containing an expression. The expression may match one or many nodes in the DOM document, and the return value is another jQuery object that can be used to manipulate the result set (you won't be receiving any arrays or DOM elements back from most jQuery methods). This allows you to chain together jQuery methods into long groups of actions. Here are some sample queries:
//get all <p> elements $("p"); //get the <div> element with an ID of myDiv $("div#myDiv"); //get all textboxes (all <input> elements with type attribute equal to "text") $("input[@type=text]");
As mentioned previously, each of these calls returns another jQuery object that can be used ...