jQuery — the jQuery library


jQuery 1.4


This is a quick reference for the jQuery library. See Chapter 19 for complete details on the library and for examples of its use. This reference page is organized and formatted somewhat differently than the other pages in this reference section. It uses the following conventions in the method signatures. Arguments named sel are jQuery selectors. Arguments named idx are integer indexes. Arguments named elt or elts are document elements or array-like objects of document elements. Arguments named f are callback functions and nested parentheses are used to indicate the arguments that jQuery will pass to the function you supply. Square brackets indicate optional arguments. If an optional argument is followed by an equals sign and a value, that value will be used when the argument is omitted. The return value of a function or a method follows the close parenthesis and a colon. Methods with no return value specified return the jQuery object on which they are invoked.

jQuery Factory Function

The jQuery function is a namespace for a variety of utility functions, but it is also the factory function for creating jQuery objects. jQuery() can be invoked in all of the ways shown below, but it always returns a jQuery object that represents a collection of document elements (or the Document object itself). The symbol $ is an alias for jQuery, and you can use $() instead of jQuery() in each of the forms following:

jQuery(sel [, context ...

Get JavaScript: The Definitive Guide, 6th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.