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

时间:2023-03-09 18:15:17
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

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

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