Loop in Jquery by using eq - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

Loop in Jquery by using eq

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">
    $(function(){/*  w  w w .ja  v  a  2  s. c  o m*/
$("#test a").each(function(k, v) {
    console.log($("#test a:eq(" + k + ")").attr("title"));
});
    });

      </script> 
 </head> 
 <body> 
  <div id="test"> 
   <a href="#" title="this is a">a</a> 
   <a href="#" title="this is b">b</a> 
   <a href="#" title="this is c">c</a> 
  </div>  
 </body>
</html>

Related Tutorials