jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Traversing/API/jQuery - Sample Code

eq(index)


	        
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="/jquery/js/jquery.js"></script>
  <script>
  $(document).ready(function(){
    $("div").eq(2).addClass("red");
  });
  </script>
  <style>
  div { width:60px; height:60px; margin:10px; float:left;
        border:2px solid blue; }
  .red { background:red; }
  </style>
</head>
<body>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</body>
</html>
            
	      
[実行結果]
[eq(index) の説明へ]