Appendix C

Selecting, Traversing, and Filtering

Method/Property Description Return Value
Selecting
$(selector) Makes a selection from the document. jQuery
jQuery(selector) An alternative name for the preceding dollar sign method. jQuery
length The number of selected elements. Number
get() Returns all selected elements as an array, rather than as a jQuery object. Array
get(index) Returns a single element from the selection; the index argument is the element's position in the selection, offset from zero. Element
index(subject) Searches the selection for the specified element and returns that element's position in the selection offset from zero. Number
Traversing and Filtering
add(selector) Adds one or more elements to the selection by virtue of an additional selector. jQuery
add(elements) Adds one or more elements to the selection by virtue of one or more element object references. jQuery
add(html) Adds one or more elements to the selection by virtue of an HTML fragment string that is parsed and converted into DOM element object references. jQuery
add(selection) Adds one or more elements to the selection by virtue of an existing selection reference. jQuery
add(selector, context) Adds one or more elements to the selection by virtue of a selector. A context provides the relative point in the document where the selector should be carried out. jQuery
addBack([selector]) Adds a set or selection of elements to the current selection; this can optionally ...

Get Web Development with jQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.