Filter Selector :
The filter selector primarily filters out the required DOM elements through specific filtering rules, which begin with ":"
According to different filtering rules, filter selectors can be divided into basic filtering, content filtering, visibility filtering, attribute filtering, sub-element filtering and Form object property filter selectors.
First, basic filter selector
Change the background color of the first DIV element to # BBFFAA
Change the background color of the last div element to # BBFFAA
Change the background color of all DIV elements that are not one class to # BBFFAA
Change the background color of the div element with an even number of index values to # BBFFAA
Change the background color of the div element with an odd index value to # BBFFAA
Change the background color of the div element with index value greater than 3 to # BBFFAA
Change the background color of the div element with index value equal to 3 to # BBFFAA
Change the background color of the div element with an index value of less than 3 to # BBFFAA
Change the background color of all the caption elements to # BBFFAA
Change the background color of all elements that are currently performing the animation to # BBFFAA
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >Second, Content filter SelectorThe filtering rules of the Content filter selector are mainly embodied in the child elements and the text content.
Change the background color of the div element containing the text ' di ' to # BBFFAA
Change the background color of a div empty element that does not contain child elements (or text elements) to # BBFFAA
Change the background color of the div element containing the class mini element to # BBFFAA
Change the background color of a DIV element that contains child elements (or text elements) to # BBFFAA
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >Third, Visibility filter selector
The Visibility filter selector selects the appropriate element based on the visible and invisible state of the element
Visible selector: Hidden contains not only elements with the style property display as none, but also elements such as text-hidden fields (<input type= "hidden" >) and Visible:hidden
Change the background color of all visible div elements to # BBFFAA
Select all elements that are not visible, use the show () method in JQuery to display them, and set their background color to # BBFFAA
Select all the text-hidden fields and print their values
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >
Step-by-step learning JQuery (c) Filter selector: Basic Filter Selector && Content Filter Selector && Visibility Filter Selector