jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Attributes/API/jQuery - Sample Code

val(val)


      <!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(){
    
    $("button").click(function () {
      var text = $(this).text();
      $("input").val(text);
    });

  });
  </script>
  <style>
  button { margin:4px; cursor:pointer; }
  input { margin:4px; color:blue; }
  </style>
</head>
<body>
  <div>
    <button>Feed</button>

    <button>the</button>
    <button>Input</button>
  </div>
  <input type="text" value="click a button" />
</body>
</html>

	 
[実行結果]
[val(val) の説明へ]