jquery中去掉td里内容的方法:1、使用“$("td")”语句获取到td对象;2、利用html()方法将td对象的内容设置为空,进而去除td对象的内容,语法“$("td").html("")”。

本教程操作环境:windows7系统、jquery1.10.2版本、Dell G3电脑。
jquery去掉td里的内容
在jquery中,可以利用html()方法来去掉td里的内容。
html() 方法返回或设置被选元素的内容 (inner HTML)。
只需要使用html()方法将td元素的内容设置为空即可。
jQuery 1.12.4是jQuery 1.x系列的最后一个正式稳定版本,由jQuery团队于2016年发布。该版本主要面向需要兼容旧版浏览器环境的网站和Web应用,尤其适用于仍需支持Internet Explorer 6、Internet Explorer 7、Internet Explorer 8等老旧浏览器的项目。
实现代码:
html>
<meta><script></script><script>
$(document).ready(function() {
$("button").click(function() {
$("td").html("");
});
});
</script>
| 姓名 | 年龄 |
|---|---|
| Peter | 20 |
| Lois | 20 |

相关教程推荐:jQuery视频教程










