jQuery - remove table row <tr> by clicking a <td>

<td><a class="delete" onclick ="delete_user($(this))">Delete</a></td>

in javascript

    function delete_user(row)
    {
        row.closest('tr').remove();


    }

Since you are dynamically adding rows to the DOM I'd suggest you use the live function:

$("tr td .cancel").live("click", function(){
  $(this).parent("tr:first").remove()
})

you can try do something like this,

Check this Demo js Fiddle

HTML

<table border=2>
    <tr>
        <td>jQuery</td>
        <td>mootools</td>
    </tr>
    <tr>
        <td>Dojo</td>
        <td>FUEL</td>
    </tr>
    <tr>
        <td>Raphael</td>
        <td>Rico</td>
    </tr>
    <tr>
        <td>SproutCore</td>
        <td>Lively Kernel</td>
    </tr>
</table>

jQuery :

$(function() {
   $('tr')
       .find('td')
       .append('<input type="button" value="Delete" class="del"/>')
       .parent()//traversing to 'tr' Element
       .append('<td><input type="button" value="Delete row" class="delrow" /></td>');

    $('.del').click(function() {
       $(this).parent().remove(); //Deleting TD element
    });

    $('.delrow').click(function(){
       $(this).parent().parent().remove(); //Deleting the Row (tr) Element
    });
});

Tags:

Jquery