How to groups table rows in html to manipulate them with jquery

JqueryHtmlDom

Jquery Problem Overview


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?

Jquery Solutions


Solution 1 - Jquery

Use <tbody> tags for this

Solution 2 - Jquery

Give them a class name that is consistent then you can do:

$('table td.classname')

To get the ones you want.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRicardo MarimonView Question on Stackoverflow
Solution 1 - JqueryRayView Answer on Stackoverflow
Solution 2 - JquerymatpolView Answer on Stackoverflow