jQuery: The Write Less, Do More JavaScript Library

Error: Failed to load processor NavWiki
No macro or processor named 'NavWiki' found

jQuery uses a new concept to make the code short and simple. For those familiar with object-oriented programming, this concept should be rather straight-forward.

In a nutshell: Every method within jQuery returns the query object itself, allowing you to 'chain' upon it, for example:

  $("p").addClass("test").show().html("foo");

Each of those individual methods (addClass, show, and html) return the jQuery object, allowing you to continue applying methods to the current set of elements.

You can take this even further, by adding or removing elements from the selection, modifying those elements and then reverting to the old selection, for example:

  $("a").filter(".clickme").click(function() {
    alert("click!");
  }).end().filter(".hideme").click(function() {
    $(this).hide();
  });

Methods that modify the jQuery selection and can be undone with end() are these: add(), ancestors(), children(), eq(), filter(), find(), gt(), lt(), next(), not(), parent(), parents() and siblings(). Check the API documentation for details of these methods.