[JavaScript] jQuery通过remove()方法移除网页中的指定元素 →→→→→进入此内容的聊天室

来自 , 2019-03-25, 写在 JavaScript, 查看 158 次.
URL http://www.code666.cn/view/2ea19e76
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
  5. </script>
  6. <script>
  7. $(document).ready(function(){
  8.   $("button").click(function(){
  9.     $("#div1").remove();
  10.   });
  11. });
  12. </script>
  13. </head>
  14. <body>
  15.  
  16. <div id="div1" style="height:100px;width:300px;border:1px solid black;background-color:yellow;">
  17.  
  18. This is some text in the div.
  19. <p>This is a paragraph in the div.</p>
  20. <p>This is another paragraph in the div.</p>
  21.  
  22. </div>
  23. <br>
  24. <button>Remove div element</button>
  25.  
  26. </body>
  27. </html>
  28.  
  29. //javascript/8112

回复 "jQuery通过remove()方法移除网页中的指定元素"

这儿你可以回复上面这条便签

captcha