1.转自:http://www.w3school.com.cn/jquery/manipulation_html.asp

设置所有 p 元素的内容:

 

 1 <html>
 2 <head>
 3 <script type="text/javascript" src="/jquery/jquery.js"></script>
 4 <script type="text/javascript">
 5 $(document).ready(function(){
 6   $(".btn1").click(function(){
 7     $("p").html("Hello <b>world!</b>");
 8   });
 9 });
10 </script>
11 </head>
12 <body>
13 <p>This is a paragraph.</p>
14 <p>This is another paragraph.</p>
15 <button class="btn1">改变 p 元素的内容</button>
16 </body>
17 </html>

 

posted on 2016-12-08 17:05  Sharpest  阅读(360)  评论(0编辑  收藏  举报