Jquery selector... hierarchical Selector
<! -- When you click the H2 element, add a color background of # 09f to the <span> element under # menu --> <! -- <SCRIPT type = "text/JavaScript"> $ (function () {$ ('h2 '). click (function () {$ ('# menu span'background .css ('background-color',' # 09f') ;}); </SCRIPT> -->
Basic Selector
<! -- Add a style for the tag selector --> <SCRIPT type = "text/JavaScript" >$ (function () {$ ('h2 '). click (function () {response ('h3'background .css ('background-color', '# 09f') ;}); </SCRIPT>
Basic filter Selector
<SCRIPT type = "text/JavaScript"> $ (function () {$ ('h2 '). click (function () {// $ ('li: first'background .css ('background-color', '# 09f'); // The first one // $ ('li: last'background .css ('background-color', '# 09f'); // The Last One // $ ('li: not(.three+'background .css ('background-color',' # 09f '); // elements whose class is not three // $ ('li: even'background .css ('background-color', '# 09f '); // element with an even index value // $ ('li: eq(1'' background .css ('background-color', '# 09f '); // element whose index value is 1 // $ ('li: gt(1'' background .css ('background-color', '# 09f '); // element with an index value greater than 1 // $ ('li: lt(1'' background .css ('background-color', '# 09f '); // element whose index value is less than 1 // $ (': header'background .css ('background-color',' # 09f'); // element of all titles $ (': focus'background .css ('background-color', '# 09f'); // elements that obtain the focus}) ;}</SCRIPT>
Visibility filter Selector
<SCRIPT src = "JS/jquery-1.8.3.js"> </SCRIPT> <SCRIPT type = "text/JavaScript"> $ (function () {// $ ('P: den den '). show (); // display text $ ('P: visable '). hide (); // hide text}); </SCRIPT> <style type = "text/CSS"> # txt_show {display: none; color: # 00c ;} # txt_hide {display: block; color: # f30 ;}</style> Attribute Selector
<! -- Change the value of the class attribute to the background color of the odds element --> <SCRIPT type = "text/JavaScript" >$ (function () {$ ("h2 "). click (function () {$ ("[class = odds]" ground .css ("background-color", "# ffffff") ;}); </SCRIPT>
Talking about those selectors