Home > front end >  Jquery selector sorting
Jquery selector sorting

Time:12-22

$(" # id ")//id selector
$(" 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 selectors

CodePudding user response:

reference 1/f, exiled program apes reply:
most of the similar to CSS selectors

HTML structure CSS j query performance js behavior interaction

CodePudding user response:

Write good! The small white is a good summary to me!

CodePudding user response:

CodePudding user response:

  • Related