jQuery API

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. If you're new to jQuery, we recommend that you check out the jQuery Learning Center.

If you're updating to a newer version of jQuery, be sure to read the release notes published on our blog. If you're coming from a version prior 1.9, you should check out the 1.9 Upgrade Guide as well.

Note that this is the API documentation for jQuery core. Other projects have API docs in other locations:


.add()

Create a new jQuery object with elements added to the set of matched elements.

.addBack()

Add the previous set of elements on the stack to the current set, optionally filtered by a selector.

.animate()

Perform a custom animation of a set of CSS properties.

Attribute Contains Selector [name*=”value”]

Selects elements that have the specified attribute with a value containing a given substring.

callbacks.fired()

Determine if the callbacks have already been called at least once.

callbacks.has()

Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list.

.children()

Get the children of each element in the set of matched elements, optionally filtered by a selector.

.closest()

For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

.css()

Get the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.

.data()

Store arbitrary data associated with the matched elements or return the value at the named data store for the first element in the set of matched elements.

deferred.progress()

Add handlers to be called when the Deferred object generates progress notifications.

.detach()

Remove the set of matched elements from the DOM.

:even Selector

Selects even elements, zero-indexed. See also :odd.

event.metaKey

Indicates whether the META key was pressed when the event fired.

.find()

Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

.finish()

Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.

:first-of-type Selector

Selects all elements that are the first among siblings of the same element name.

.has()

Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.

.hover()

Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.

.html()

Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element.

:image Selector

Selects all elements of type image.

.is()

Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.

jQuery()

Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.

jQuery.Callbacks()

A multi-purpose callbacks list object that provides a powerful way to manage callback lists.

jQuery.cssHooks

Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.

jQuery.data()

Store arbitrary data associated with the specified element and/or return the value that was set.

jQuery.Deferred()

A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.

jQuery.each()

A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function’s arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.

jQuery.grep()

Finds the elements of an array which satisfy a filter function. The original array is not affected.

jQuery.inArray()

Search for a specified value within an array and return its index (or -1 if not found).

jQuery.isFunction()

Determines if its argument is callable as a function.

jQuery.removeData()

Remove a previously-stored piece of data.

jQuery.speed

Creates an object containing a set of properties ready to be used in the definition of custom animations.

jQuery.support

A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery’s internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project’s feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.

jQuery.uniqueSort()

Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.

jQuery.when()

Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

.length

The number of elements in the jQuery object.

.load()

Bind an event handler to the “load” JavaScript event.

.map()

Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.

.next()

Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.

.nextUntil()

Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.

:nth-last-of-type() Selector

Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first.

.parentsUntil()

Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.

.prepend()

Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.

.prev()

Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.

.promise()

Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.

.prop()

Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.

.scroll()

Bind an event handler to the “scroll” JavaScript event, or trigger that event on an element.

.serialize()

Encode a set of form elements as a string for submission.

.text()

Get the combined text contents of each element in the set of matched elements, including their descendants, or set the text contents of the matched elements.

.val()

Get the current value of the first element in the set of matched elements or set the value of every matched element.