我正在用C#,.NET Framework 4.7和jQuery 3.1.1開發ASP.NET MVC應用程序。隱藏特定行後的所有行
我有一個表的視圖:
<table id="myTable">
<tbody>
<tr> ... </tr>
<tr> ... </tr>
<tr> ... </tr>
<tr id="row_x"> ... </tr>
<tr> ... </tr>
<tr> ... </tr>
<tr> ... </tr>
...
我想隱藏的所有行<tr id="row_x"> ... </tr>
下行,但我不知道如何訪問這些行。我是否需要爲所有人設置一個ID?
我想過用<div>
包圍它們,但我認爲這不是一個好主意或可能。
你想隱藏所有'td',所以你可以使用'$(「#row_x td」)。hide()'如果你想隱藏'tr'後的所有內容,你應該使用'$ 「#row_x」)。nextAll()。hide()' –