Javascript examples for jQuery Selector:nth-child
UL LI Children Selection
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> <script type="text/javascript"> $(window).load(function(){/*from www . j ava 2 s .com*/ $("li").each(function(){ $(this).find("a").attr("style","color:red;"); }) }); </script> </head> <body> <li> <a href="#">Test 1</a> </li> <li> <a href="#">Test 2</a> </li> <li> <a href="#">Test 3</a> </li> </body> </html>