Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Locate all the paragraphs after the second child in the body and give them a class

< html>   <head>     <script type="text/javascript" src="js/jquery-1.3.2.js"></script>     <script type="text/javascript">         $(document).ready(function(){               $(":nth-child(1)").nextAll("p").css("color","red");         });     </script>   </head>   <body>     <body>                          <p>p</p>           <div>div</div>                    <p>p</p>           <div>div</div>           <p>p</p>           <div>div</div>                </body> </html>