Search code examples
jqueryhtml-tableclone

Cloning a row which has display none style and appending to the end of tbody


Using jQuery, how can I create a clone of a Row which has display: none as its style, and append to the end of the tbody?

My table is:

<table>
  <tbody>
   <tr id="tRow0" style="display : none ;">
      <td>  // Some contents (textbox,dropdown etc..)
     </td>
   </tr>
 </tbody>
</table>

I want to create a clone of the hidden row and append to the Table. This new row should be visible to screen.


Solution

  • $('#tRow0').clone().show().appendTo( $('#tRow0').parent() );