jquery remove parent tr not working in first time -
on click of delete button, want remove parent tr. problem when click on delete, blinks , doesn't remove tr on first click , when click delete second time, iut gets removed. please help
$(".adel").on('click', function () { $(this).parents('tr').hide(); });
<tr id="rowtr"> <td></td> <td id="rowtd"> <a id="" class="adel" href=''> <img src='del.png'> </a> </td> </tr>
try this:
$(".adel").on('click', function (e) { e.preventdefault(); $(this).closest('tr').remove(); });
working fiddle here : http://jsfiddle.net/2zhbc/1/
Comments
Post a Comment