jQuery修改td高的方法:1、使用attr()方法,语法“$("td").attr("style","height: 高度值;");”;2、使用css()方法,语法“$("td").css("height","高度值");”。

本教程操作环境:windows7系统、jquery1.10.2版本、Dell G3电脑。
jQuery怎么修改td的高
1、使用attr()方法
attr() 方法可设置被选元素的属性值。
html>
<meta><script></script><script>
$(document).ready(function() {
$("button").click(function() {
$("td").attr("style","height: 50px;");
});
});
</script>
| 姓名 | 年龄 |
|---|---|
| Peter | 20 |
| Lois | 20 |

jQuery 1.12.4是jQuery 1.x系列的最后一个正式稳定版本,由jQuery团队于2016年发布。该版本主要面向需要兼容旧版浏览器环境的网站和Web应用,尤其适用于仍需支持Internet Explorer 6、Internet Explorer 7、Internet Explorer 8等老旧浏览器的项目。
2、使用css()方法
html>
<meta><script></script><script>
$(document).ready(function() {
$("button").click(function() {
$("td").css("height","50px");
});
});
</script>
| 姓名 | 年龄 |
|---|---|
| Peter | 20 |
| Lois | 20 |

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










