如何在 html 中对表格行进行分组以使用 jquery 操作它们
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2470028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to groups table rows in html to manipulate them with jquery
提问by Ricardo Marimon
I have an html table with many rows. I'm currently grouping several rows inside a div (I know this is ugly) and then show or hide the divs to show or hide the rows inside it. Is there a standard way to do this. Something like rowgroup or multiple tbody instead of this ugly div grouping?
我有一个多行的 html 表。我目前正在将 div 内的几行分组(我知道这很难看),然后显示或隐藏 div 以显示或隐藏其中的行。有没有标准的方法来做到这一点。像 rowgroup 或多个 tbody 之类的东西,而不是这个丑陋的 div 分组?
回答by Ray
Use <tbody>
tags for this
<tbody>
为此使用标签
回答by matpol
Give them a class name that is consistent then you can do:
给他们一个一致的类名,然后你可以这样做:
$('table td.classname')
To get the ones you want.
去得到你想要的。