jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Core/API/jQuery - Sample Code

each(callback)


             
<!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>
  window.onload = (function(){try{
    
    $("span").click(function () {
      $("li").each(function(){
        $(this).toggleClass("example");
      });
    });
  }catch(e){}});</script>
  <style>
  ul { font-size:18px; margin:0; }
  span { color:blue; text-decoration:underline; cursor:pointer; }
  .example { font-style:italic; }
  </style>
<style>html,body{border:0; margin:0; padding:0;}</style></head>
<body>
  To do list: <span>(click here to change)</span>
  <ul>
    <li>Eat</li>
    <li>Sleep</li>
    <li>Be merry</li>
  </ul>
</body>
</html>
            
          
[実行結果]
[each(callback) の説明へ]