The key point is to learn how the JQuery selector accurately selects the elements that you want to apply the effect to. The JQuery element selector and the property selector allow you to select HTML elements by tag name, property name, or content. Selectors allow you to manipulate HTML element groups or individual elements. HTML DOM Terminology: selectors allow you to manipulate DOM element groups or individual DOM nodes
$ ("#myELement") select an element with an ID value equal to myelement, the ID value cannot be duplicated in the document only one ID value is myelement so get the unique element $ ("div") Select all div tag elements, return the DIV element array
$ (". MyClass") Select all elements of the CSS using the MyClass class $ ("*") to select all the elements in the document, you can use a variety of options for joint selection: for example $ ("#myELement, Div,.myclass")
Cascade selector:
$ ("form input") selects all the input elements in the form element
$ ("#main > *") Select all child elements with an ID value of main
$ ("label + input") selects all of the next INPUT element nodes of the label element, and the test selector returns all input label elements that follow the label tag directly followed by an input tag
$ ("#prev ~ div") sibling selector, which returns all the div tags that belong to the same parent element for the label element with ID prev
Basic Filter Selector:
$ ("Tr:first") selects the first of all TR elements
$ ("Tr:last") selects the last of all TR elements
$ ("Input:not (: Checked) + span")
$ ("Tr:even") Select all of the TR elements of the section 0,2,4 ... Element (Note: The sequence number starts at 0 because the selected number of elements is an array.)
$ ("tr:odd") Select all of the TR elements of the section 1,3,5 ... An element
$ ("Td:eq (2)") select the TD element with the number 2 in all TD elements
$ ("TD:GT (4)") Select all TD elements in the TD element with an ordinal greater than 4
$ ("Td:lt (4)") selects all TD elements in the TD element with an ordinal less than 4
$ (": Header") Select H1, H2, H3 and the like
$ ("div:animated") Select the element that is performing the animation effect
$ ("Div:contains (' John ')") Select all the elements in the div that contain the John text
$ ("Td:empty") Select all the arrays of TD elements that are empty (nor include text nodes)
$ ("Div:has (P)") Select all DIV elements that contain p tags
$ ("td:parent") Select all the element array with TD as parent node
Visual Filter Selector:
$ ("Div:hidden") Select all the hidden div elements
$ ("div:visible") Select all of the visual DIV elements
Attribute Filter Selector:
$ ("Div[id]") Select all DIV elements that contain the id attribute
$ ("input[name= ' newsletter ')" selects all the name attributes equal to the INPUT element of ' newsletter '
$ ("input[name!= ' newsletter ')" selects all the name attribute not equal to ' newsletter ' INPUT element
$ ("input[name^= ' News ')") Select all the name attributes to start with ' news ' INPUT element
$ ("input[name$= ' News ')") Select all the name attributes to end with ' news ' INPUT element
$ ("input[name*= ' Man ')") Select all the name attributes that contain the ' news ' INPUT element
$ ("input[id][name$= ' Man ')") can use multiple attributes for federated selection, which is to get all the elements that contain the id attribute and then the property ends with a man
child element Filter Selector:
$ ("div span:first-child") returns an array of the first child nodes of all DIV elements
$ ("div span:last-child") returns an array of the last nodes of all DIV elements
$ ("div button:only-child") returns an array of all the child nodes that have only one child node in all Div
Form element selector:
$ (": Input") Select all form input elements, including input, textarea, select, and button
$ (": Text") Select all text input elements
$ (":p assword") Select all password input elements
$ (": Radio") Select all radio input elements
$ (": CheckBox") Select all the checkbox input elements
$ (": Submit") Select all the submit input elements
$ (": Image") Select all the image input elements
$ (": Reset") Select all the reset input elements
$ (": Button") Select all the button input elements
$ (": File") Select all the file input elements
$ (": Hidden") Select all input elements of type hidden or hidden fields of the form
Form element Filter Selector:
$ (": Enabled") Select all the actionable form elements
$ (":d isabled") Select all the non-actionable form elements
$ (": Checked") Select all of the checked form elements
$ ("select Option:selected") selects all of the sub-elements in the Select to be selecte
About the jquery selector