Monday, 15 March 2010

delete tr element in jquery -



delete tr element in jquery -

i have table of tr elements in click on delete each row, deletes table. html below

<tr class="tr_body"> <td> <input type="text" class="fabric_input createwoblockbg little ui-autocomplete-input" name="basefabrics[]" onfocus ="loaduniqueajax(' . "'fabric_input'" . ')" autocomplete="off"> </td> <td> <input type="text" class="fac_input createwoblockbg little ui-autocomplete-input" name="facsnapshots[]" id="facsnapshot" autocomplete="off"> </td> <td> <a class ="deleterow">delete</a> </td> </tr>

and jquery below

$('.deleterow').click(function(){ var elementdelete = $(this).parent().parent(); $('#tablelist').remove(elementdelete); });

however returns uncaught typeerror: object [object object] has no method 'replace' when click on deleterow anchor tag. in advance help.

working illustration on js bin.

$('.deleterow').click(function() { $(this).closest("tr") .remove(); });

jquery

No comments:

Post a Comment