Get child element by index in Jquery - Javascript jQuery Selector

Javascript examples for jQuery Selector:eq

Description

Get child element by index in Jquery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w  ww. ja  va 2  s  .  co m*/
console.log($('div.second div:eq(0)').attr('id'));
    });

      </script> 
 </head> 
 <body> 
  <div class="second"> 
   <div class="selector" id="selFirst"></div> 
   <div class="selector" id="selSecond"></div> 
   <div></div> 
  </div>  
 </body>
</html>

Related Tutorials