Query Methods

Query methods act like the main query selector, they can replace what is selected or add to what has been selected. Each example below will be demonstrated using the css method to illuminate the result.

Swap Method:

The swap method will swap what is currently selected in the main selector for the element passed into the swap method. If other methods are performed before adding the swap method it will still perform the methods before swap was initiated.

Supported flags: all, odd, even, single, and, range

main selector flags: all, odd, even, single, and, range

​

Attach Method:

Supported flags: all, odd, even, single, and, range

main selector flags: all, odd, even, single, and, range

The attach method will attach more elements to the main selector. Another cool thing is that you can add multiple elements all within the same method.

Detach Method:

Supported flags: all, odd, even, single, and, range

main selector flags: all, odd, even, single, and, range

The detach method will remove an element from a list of selected elements. 

Within Method:

Supported flags: all, odd, even, single, and, range

main selector flags: single

The within method looks for an element within another element.

Any Method:

Supported flags: none

main selector flags: all, odd, even, single, and, range

​The any method will randomly select elements, you're best off using two or more elements for this to work effectively.

The any method takes an optional boolean parameter. If this parameter is set to true the any method will select multiple elements from the list as seen above, if no arguments are passed in it will only select one.

Search Method:

Supported flags: none

main selector flags: single

The search method searches within the scope of a parent element for a child or children that contain a particular value.

Parameters

param 1: A string value of commonly appearing text to search for within the selected parent node

param 2: A string value of what tag types to exclude from the search query

goTo Method:

The goTo method selectes an element local to the main query selector. The element can be a parent element, sibling or a child and the goTo method will iterate through the local elements until the specified element is reached.

Parameters

param 1: A string command directing the method in which way to go to find the element to select. 

Previous sibling commands: "prev", "previousNode" or "previousSibling"

Next sibling commands: "next", "nextNode" or "nextSibling"

Parent element commands: "parent" or "parents" 

Child element commands: "child" or "children"

param 2: A string value of the target element can be a class, id or tag name.