Jquery’s selectors are incredibly powerful. Here’s a quick summary of the common methods of finding elements.

$(“#myELement”) select the element whose ID is equal to myELement, and the id cannot be repeated. There is only one element whose ID is myELement in the document, so you get a unique element. $(“div”) Select all of the div tags, $(“*”) select all the elements in the document, for example $(“#myELement,div,.myClass”)

Cascade selector:

$(“#main > *”); $(“#main > *”); $(“#prev ~ div”); $(“#prev ~ div”); $(“#prev ~ div”)

Basic filter selector:

$(“tr:first”) selects the first $of all tr elements (“tr:last”) selects the last $(“input:not(:checked) + span”) filters out all input elements of the :checked selector

$(“tr:even”) select all tr elements 0,2,4… . (Note: since multiple elements are selected as arrays, the ordinal starts at 0)

$(“tr:odd”) select all tr elements 1st, 3rd, 5th… . $(“td:eq(2)”) select all td elements whose sequence number is 2 $(” TD :gt(4)”) select all TD elements whose sequence number is greater than 4 $(” TD :ll(4)”) select all TD elements whose sequence number is less than 4 $(“:header”) $(“div:animated”)

Content Filter selector:

$(“div:contains(‘John’)”) Select all div elements that contain John text. $(“td:empty”) Select an array of all td elements that are empty (also excluding text nodes). $(“div:has(p)”) Select all div elements that contain p tags $(“td:parent”) select the array of all elements with td as the parent

Visual Filter selector:

$(“div:hidden”) select all div elements that are hidden

Property filter selector:

$(“input[name=’newsletter’]”) select all div elements with id attribute $(“input[name=’newsletter’]”) select all input elements whose name attribute equals ‘newsletter’ $(“input[name!=’news ‘]”) select all input elements whose name attribute does not equal ‘newsletter’. $(“input[name!=’news ‘]”) select all input elements whose name attribute starts with ‘news’ $(“input[name*=’ news’]”) select all input elements whose name attribute contains ‘news’. $(“input[name*=’man’]”) select all input elements whose name attribute contains ‘news’ $(“input[id][name$=’man’]”) $(“input[id][name$=’man’]”) $(“input[id][name$=’man’]”

Child element filter selector:

$(“ul li:nth-child(2)”),$(“ul li:nth-child(odd)”),$(“ul li:nth-child(3n + 1)”) $(“div span:first-child”) $(“div span:last-child”) $(“div button: last-child”) $(“div button: last-child”) Returns an array of all child nodes in all divs that have only one child node

Form element selector:

$(“:input”) select all form input elements, Includes input, textarea, Select and button $(“:text”) select all text input elements $(“:password”) Select all password input elements $(“:radio”) Select all radio input elements $(“:checkbox”) select all checkbox input elements $(“:submit”) select all Submit input elements Select all reset input elements $(“:button”) select all button input elements $(“:file”) Select all file input elements $(“:hidden”) Select all input elements or form hidden fields of type hidden

Form element filter selector:

$(“:enabled”) Select all operable form elements $(“:disabled”) Select all inoperable form elements $(“:checked”) Select all checked form elements $(“select option:selected”) Select all selected children of select

Choose a name for “S_03_22″ input text box on a text value of the td $(” input [@ name = S_03_22] “). The parent (). The prev (). The text ()

Name begins with a “S_”, and not end in “_R” $(” input [@ name ^ = ‘S_’] “.) not (” [@ $= ‘_R’ name] “)

$(” input @name =radio_01 “).val(); $(” input @name =radio_01 “).val(); $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”) $(“A+B”