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>

Comments

Popular posts from this blog

Read Images from a xlsx file using Apache POI

Read Excel using Apache POI - Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException:

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'