手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery使用empty()方法删除元素及其所有子元素的方法
jQuery使用empty()方法删除元素及其所有子元素的方法
摘要:本文实例讲述了jQuery使用empty()方法删除元素及其所有子元素的方法。分享给大家供大家参考。具体实现方法如下:$(document)...

本文实例讲述了jQuery使用empty()方法删除元素及其所有子元素的方法。分享给大家供大家参考。具体实现方法如下:

<!DOCTYPE html> <html> <head> <script src="js/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").empty(); }); }); </script> </head> <body> <div id="div1"> This is some text in the div. <p>This is a paragraph in the div.</p> <p>This is another paragraph in the div.</p> </div> <br> <button>Empty the div element</button> </body> </html>

希望本文所述对大家的jQuery程序设计有所帮助。

【jQuery使用empty()方法删除元素及其所有子元素的方法】相关文章:

jquery简单实现外部链接用新窗口打开的方法

jQuery获取字符串中出现最多的数

jQuery计算文本框字数及限制文本框字数的方法

Jquery动态添加输入框的方法

js实现鼠标经过表格行变色的方法

jQuery fancybox在ie浏览器下无法显示关闭按钮的解决办法

Javascript实现每日自动换一张图片的方法

jQuery获取页面元素绝对与相对位置的方法

js禁止页面刷新与后退的方法

JS+DIV实现鼠标划过切换层效果的方法

精品推荐
分类导航