1. text() - 设置或返回所选元素的文本内容
  2. html() - 设置或返回所选元素的内容(包括 HTML 标记)
  3. val() - 设置或返回表单字段的值

t.gif

  1. <script>
  2. $(document).ready(function(){
  3. $("#btn1").click(function(){
  4. alert("Text: " + $("#test").text());
  5. });
  6. $("#btn2").click(function(){
  7. alert("HTML: " + $("#test").html());
  8. });
  9. });
  10. </script>