JQuerySelector

JQuerySelector class is used for finding DOM elements using jQuery selector mechanism. jQuery uses Sizzle as its search engine (which you can use directly by using SizzleSelector), however it also contains additional features like traversing methods that Sizzle itself does not support.

Constuctor

Initializes a new instance of the JQuerySelector class.

The basic constructor with the selector string as an argument.

var selector = new JQuerySelector(":text");

Add

Adds elements to the set of matched elements.

var selector = new JQuerySelector("div").Add("p");

AddBack

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

var selector = new JQuerySelector("div").Find("span").AddBack();

AndSelf

Add the previous set of elements on the stack to the current set.

var selector = new JQuerySelector("div").Find("span").AndSelf();

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.

Contents

Get the children of each element in the set of matched elements, including text and comment nodes.

End

End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.

Eq

Reduce the set of matched elements to the one at the specified index.

Filter

Reduce the set of matched elements to those that match the selector or pass the function's test.

Find

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

First

Reduce the set of matched elements to the first in the set.

Has

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

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.

Last

Reduce the set of matched elements to the final one in the set.

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.

NextAll

Get all following siblings of each element in the set of matched elements, optionally filtered by a 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.

Not

Remove elements from the set of matched elements.

OffsetParent

Get the closest ancestor element that is positioned.

Parent

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

Parents

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

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.

Prev

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

PrevAll

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

PrevUntil

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

Siblings

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

Slice

Reduce the set of matched elements to a subset specified by a range of indexes.

Last updated

Was this helpful?