Search within TutorialsPark

Jquery Selection Result


Understanding the Selection result of jQuery Object Members


Understanding the Selection Result

The result of jQuery selection using $ function is named as jQuery Object, it represents zero or more DOM elements

Table : jQuery Object Members

Selector Description Returns
context To return the set of element used as the search context HTMLElement
each(function) To perform the function on each of the selected element jQuery
get(index) To get the HTMLElement object at the specified index HTMLElement
index(HTMLElement) To return the index of the specified HTMLElement number
index(jQuery) To return the index of the first element in the jQuery object number
index(selector) To return the index of the first element in the jQuery object in the set of elements matched by selector number
length To return the number of elements contained by the jQuery object number
selector To return the selector used string
size() To return the number of elements in the jQuery object number
toArray() To return the HTMLElement objects contained by the jQuery object as an array HTMLElement[]

Determining the jQuery Selector

The selector property returns the selector that is used to describe the element in jQuery Object, or a selector that selects combination of elements

Example: Determing the jQuery Selector

Give it a TRY! » Note: The selector in used is shown as the result.


Jquery Determining the Context

Just like selectors, the context property provides the details of the context used to create the jQuery Object.

Example: Jquery Select Element using Extension Type Selectors

Give it a TRY! » Note:The scope (i.e context) of the jQuery is the element UL.


Jquery DOM Objects : Creating jQuery Objects from DOM objects

A jQuery object can be created by simply passing an HTMLElement object or an array of HTMLElement as an argument for the $ function.

The demo below selects p element using jQuery Object instead of using jQuery directly with a selector.

Example: Jquery DOM Objects Creating jQuery Objects from DOM objects

Give it a TRY! » Note:This demo shows how you can create a jQuery Object from a single HTMLElement object.