jQuery(二)button事件改变标签值

button事件改变标签值

例子一:

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $(".btn1").click(function(){
    $("p").text("Hello world!");
  });
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button class="btn1">改变所有 p 元素的文本内容</button>
</body>
</html>

转自:

    [1]  http://www.w3school.com.cn/jquery/manipulation_text.asp

 ----- ----- ----- ----- 谢谢大佬打赏----- ----- ----- ----- ----- 

           

原文地址:https://www.cnblogs.com/Jomini/p/8780777.html