gpt4 book ai didi

jquery - 删除第一列后保留表格高度 'tr'

转载 作者:太空宇宙 更新时间:2023-11-04 13:38:00 24 4
gpt4 key购买 nike

我正在处理当前应该使用 jQuery 动态删除第一列的表。删除第一列后,tr 高度会根据内容自行调整。

我希望即使在删除第一列后 tr 高度也相同。请提出一个答案。

这是我用来删除第一列的代码:

$(document).ready(function(){
$('.remove tr').each(function(){
$(this).find('td:first-child').remove();
$(this).find('th:first-child').remove();
})
})

请看这个Fiddle

最佳答案

在你的 css 中添加 line-height:0px、宽度和高度,如下所示:

td,th{
border:1px solid #ccc;
line-height:0px;
height:40px;
width:100px;
}

查看更新后的 fiddle :Demo希望这会有所帮助。

关于jquery - 删除第一列后保留表格高度 'tr',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22893667/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com