jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Attributes/API/jQuery - Sample Code

html()


      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    
    $("p").click(function () {
      var htmlStr = $(this).html();
      alert(htmlStr);
    });

  });
  </script>
  <style>
  p { margin:8px; font-size:20px; color:blue; 
      cursor:pointer; }
  b { text-decoration:underline; }
  button { cursor:pointer; }
  </style>
</head>
<body>
  <p>
    <b>Click</b> to show the <span id="tag">html</span>

  </p>
  <p>
    This <button name="nada">button</button> does nothing.
  </p>
</body>
</html>
	 
[実行結果]
[html() の説明へ]