Search within TutorialsPark

Jquery Selector Reference


Learn to use jQuery events that are triggered by Form Event


jQuery Events: Form Events

jQuery has a set of methods to use and handle Form related events.

Table : Form Event Methods

Selector Description
* It matches all the elements
#id To match the element with the given ID
element To match the element of the given type
.class To match all element with the given class
a, b To match all elements that are matched by a or b.
a b To match elements b that are descendants of a.
a > b To match elements b that are children of a.
a + b To match elements b that immediately follow a.
a ~ b To match elements b that are siblings of a and flow a.

Table : Position among Siblings

Selector Description
:nth-child(index) To match elements that are the index child of their parent element(1-based)
:nth-child(even) To match the elements that are an even child of their parent element(1-based)
:nth-child(odd) To match the element which are an odd child of their parent element(1-based)
:nth-child(formula) To match elements that are the nth child of their parent element(1-based).
:nth-last-child() Same as :nth-child() , but counting from the last element to the first.
:first-child To match elements that are the first child of their parent
:last-child To match elements that are the child of their parent
:only-child To match element that are the only child of their parent.
:nth-of-type() Same as :nth-child(), but only counting elements of the same element name.
:nth-last-of-type() Same as :nth-last-child(), but only counting elements of the same element name.
:first-of-type() To match elements which are the first child of the same element name among their siblings.
:last-of-type() To match element which are the last child of the same element name among their siblings
:only-of-type() To match element that are the only child of the same element name among their siblings

Table : Position among matched elements

Selector Description
:first To match the first element in the result set
:last To match the last element in the result set.
:not(a) To match all elements in the result set that are not matched by a.
:even To match even elements in the result set(0-based)
:odd To match the odd elements in the result set(0-based).
:eq(index) To match a numbered element in the result set(0-based)
:gt(index) To match all element in the result set after(greater than) the given index(0-based)
:lt(index) To match elements in the result set before(less than) the given index(0-based).

Table : Form Selectors

Selector Description
:input To match all input, select, textarea and button elements
:text To match input element with type="text"
:password To match input element with type="password"
:file To match input element with type="file"
:radio To match input element with type="radio"
:checkbox To match input element with type="text"
:submit To match input element with type="submit"
:image To match input element with type="image"
:reset To match input element with type="reset"
:button To match input element with type="button" and button element
:enabled To match enabled form elements.
:disabled To match disabled form elements
:checked To match checked checkboxes and radio buttons
:selected To match selected option elements

Table : Form Selectors

Selector Description
:root To match the root element of the document
:header To match the header element
:animated To match elements with an animation in progress.
:contains(text) To match elements containing the given text.
:empty To match element with no child nodes
:has(a) To match elements containing a descendant element matching a.
:parent To match element that have child nodes.
:hidden To match element that are hidden , either using CSS or input types.
:visible To match inverse of :hidden
:focus To match element that has the keyboard focus.
:lang(language) To match Element with the given language code.
:target To match whichever element is targeted by the URI's fragment identifier, if any.

Table : Form Selectors

Selector Description
[attr] To match element that have the attribute attr
[attr="value"] To match element that have the attribute value
[attr!="value"] To match element that have the attribute not value
[attr^="value"] To match element that have the attribute beginning with value
[attr$="value"] To match element that have the attribute ending with value
[attr*="value"] To match element that have the attribute containing the substring value
[attr~="value"] To match element whose attr attribute is a space-delimited set of strings, on of which is value
[attr|="value"] To match element whose attr attribute is either equal to value or begins with value followed by a hyphen.