gpt4 book ai didi

jquery - 悬停 td 时隐藏所有表格

转载 作者:行者123 更新时间:2023-11-28 12:09:55 26 4
gpt4 key购买 nike

我正在尝试创建一个表格,当悬停特定单元格时,我希望所有表格都不可见。这是我的简单代码:

<!DOCTYPE html>
<html>
<head>
<style>
h4:hover
{
visibility:collapse;
}
table
{
visibility:visible;
}
#vis {background:#008500; color:#fff;}
td#vis:hover{
table.style.visibility:"collapse";
}
</style>
</head>
<body>
<p>
Each table starts with a table tag.
Each table row starts with a tr tag.
Each table data starts with a td tag.
</p>
<h4>Two rows and three columns:</h4>
<table border="1">
<tr>
<td id="vis">100</td>
<td>200</td>
<td>300</td>
</tr>
<tr>
<td>400</td>
<td>500</td>
<td>600</td>
</tr>
</table>
</body>
</html>

它不起作用,实际上我不知道必须在 td#vis:hover 部分中包含什么。我希望有人能帮助并尽快回复。

最佳答案

试试这个

Demo

.hover
{
visibility:collapse;
}

$('table tr td').hover(function(){
$(this).toggleClass('hover');
});

关于jquery - 悬停 td 时隐藏所有表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19559434/

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