• text() - 设置或返回所选元素的文本内容
  • html() - 设置或返回所选元素的内容(包括 HTML 标记)
  • val() - 设置或返回表单字段的值
$("#btn1").click(function(){
  alert("Text: " + $("#test").text());
});

$("#btn2").click(function(){
  alert("HTML: " + $("#test").html());
});

$("#btn1").click(function(){
  alert("Value: " + $("#test").val());
});

$("button").click(function(){
  alert($("#w3s").attr("href"));
});

 

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2021-09-22
  • 2022-02-07
猜你喜欢
  • 2021-11-07
  • 2021-05-30
  • 2021-05-24
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案