dimanche 20 octobre 2019

Transferring selected data into another table in another page

i have 2 page and 2 table, in page 1(table 1) i want to get selected rows and in page 2(table 2) i want to show the selected rows before

This is the first table in page 1:

<table class="src-table">
    <tr>
        <th>Select</th>
        <th>Firstname</th>
    </tr>
    <tr>
        <td>
            <input type="checkbox">
        </td>
        <td>Jill</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox">
        </td>
        <td>Eve</td>
    </tr>
</table>
<br>
<input type="button" value="Submit" id="submit">

This is the second table in page 2:

<table class="target-table">
    <tr>
        <th>Select</th>
        <th>Firstname</th>
    </tr>
</table>

This is the the jquery that I use if transferring rows in 1 page:

 $(function(){
       $(document).on("click","#submit",function(){
              var getSelectedRows = $(".src-table input:checked").parents("tr").clone();

              $(".target-table tbody").append(getSelectedRows);
          })
 })



Aucun commentaire:

Enregistrer un commentaire