Javascript examples for jQuery:Tag Traversing
Find first two children
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <style id="compiled-css" type="text/css"> h1,p{/* w w w.j a v a 2 s. co m*/ display:none; } </style> <script type="text/javascript"> $(window).load(function(){ $('div > *:lt(2)').show(); }); </script> </head> <body> <div> <h1>Heading</h1> <p>Paragraph 1</p> <p>Paragraph 2</p> </div> </body> </html>