HTML and CSS Reference
In-Depth Information
(Filters are always prepended with a colon; this is therefore combining two selectors, one
to select tr elements, and then another limiting the selection to tr elements that are in the
first position amongst their siblings.)
Filters can also accept parameters; therefore we can find any arbitrary row in the table using
the following filter:
> $('tr:eq(1)')
This will find the second row in the table (counting starts at 0).
Alternatively we may wish to find any row except the first row, so we could use the fol-
lowing filter:
> $('tr:gt(0)')
This is selecting all rows with a position greater than 0.
Other useful filters are as follows:
:even finds all even numbered elements in a selection.
:odd finds all odd numbered elements in a selection.
:not(selection) finds all elements that do not match the selection.
:checked finds radio buttons or check boxes that are checked.
:selected finds options in select boxes that are selected.
:contains(text) finds elements that contain a given piece of text.
:empty finds all elements that have no children.
:focus finds the element that currently has focus.
:last finds the last element in a set.
In addition, filters can simplify the process of selecting input elements. Since most input
fields use the element type of input , it is necessary to also query on the attribute type .
jQuery contains the following filters for finding specific types of input field:
• :hidden
• :text
• :checkbox
• :password
• :radio
Search WWH ::




Custom Search