$(" div ")//element selectors
$(" classname ")//class selector
$(" classname, classname1, # id1 ")//selector
2. Level selector
$(" # id> "Classname)//child element selectors
$(" # id. The classname ")//descendant element selector
$(" # id +. The classname ")//next to the next element selector
$(" # id ~. The classname ")//sibling selectors
3. The filter selector (key)
$(" li: first "),//the first li
$(" li: the last "),//the last li
$(" li: even ")//choose the subscript is even li
Li: $(" odd ")//select the subscript for odd li
$(" li: eq (4))//subscript equals 4 li (the fifth li element)
$(" li: gt (2) ")//greater than 2 subscript li
$(" li: lt (2) ")//subscript li of less than 2
$(" li: not (# runoob))//select all except id="runoob" li
3.2 content filtering selector
$(" div: the contains (' Runob ') "),//the element containing the text Runob
Td: $(" empty ")//do not contain child elements or text empty element
$(" div: from the selector () ")//contains selector matching element
Td: $(" parent ")//contain child elements or text element
3.3 visibility filtering selector
Li: $(" hidden ")//match all invisible elements, or type of hidden element
Li: $(" visible ")//match all visible element
3.4 attribute filter selector
$(" div [id] ")//all contains the id attribute of div elements
$(" div id='123'] ")//id attribute value is 123 div elements
$(" div [id!='123'] ")//id attribute value is not equal to 123 div element
$(" div [id ^='qq'] ")//qq id attribute values in the beginning of the div element
$(" div [$id='zz'] ")//id attribute value to the div element at the end of zz
$(" div [id *='bb'] ")//id attribute values include bb div elements
$(" input [id] [$='man' name] ")//multiple attribute filter, at the same time satisfy the conditions of the two attributes of the element
3.5 state filtering selector
$(" input "enabled")//match the available input
$(" input "disabled")//match, not with the input of
$(" input "checked")//match the selected input
Option: $(" selected ")//match the selected option
4. The form selector
$(" input ")//match all input, textarea, select and button elements
$(" : the text ")//all of the multiline text box, $(" : the text ") is equivalent to $("/type="text"), it is recommended to use $(" input: text ") is more efficient, the same below
: $(" password ")//all the password
$(" : the radio ")//all radio button
$(" : "checkbox)//all checkbox
: $(" submit ")//all submit button
$(" : reset ")//all the reset button
: $(" button ")//all button button
$(" : the file ") all files//domain

CodePudding user response:
Most of the similar to CSS selectorsCodePudding user response: