javascript - Hide all the rows after a specific row -


i'm developing asp.net mvc application c#, .net framework 4.7 , jquery 3.1.1.

i have view table:

<table id="mytable"> <tbody>    <tr> ... </tr>    <tr> ... </tr>    <tr> ... </tr>    <tr id="row_x"> ... </tr>    <tr> ... </tr>    <tr> ... </tr>    <tr> ... </tr>    ... 

i want hide rows under row <tr id="row_x"> ... </tr> don't know how access rows. need set id of them?

i've thought surround them <div> don't think idea or possible.

you can use jquery method nextall()

$("#row_x").nextall().hide();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <table id="mytable">    <tbody>      <tr>        <td>row 1</td>      </tr>      <tr>        <td>row 2</td>      </tr>      <tr>        <td>row 3</td>      </tr>      <tr>        <td>row 4</td>      </tr>      <tr id="row_x">        <td>row 5</td>      </tr>      <tr>        <td>row 6</td>      </tr>      <tr>        <td>row 7</td>      </tr>      <tr>        <td>row 8</td>      </tr>      <tr>        <td>row 9</td>      </tr>    </tbody>  </table>


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -