Remove table row using JQuery


If you are using JQuery and you have created a table and you want to delete it's row dynamically then you can use following code.


$(document).ready(function() {
    $("#DemoTable tr").click(function() {
            $(this).remove();
        });
});

Here DemoTable is the html Id attribute. So when you will click on the div containing particular row, it will be deleted.
For example if you are using table like..

<table id="DemoTable" >
<tr> 
   <td  width="25%"> </td>
   <td  width="75%"> </td>
</tr>
<tr> 
   <td  width="25%"> </td>
   <td  width="75%"> </td>
</tr>
</table>

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Android: where to run keytool command in android