How to remove row based on clicking on a separate div in Jquery/Javascript? -
i want know best way accomplish following.
i have table:
<table> <tr><td>1</td><td>some1</td></tr> <tr><td>2</td><td>some2</td></tr> <tr><td>3</td><td>some3</td></tr> </table>
when click on td (1,2,or 3), div visible id "#removediv" has basic text "remove". click on div, , row had clicked on div show, removed.
i imagine have pass information row or index "#removediv" object #removediv event handler know row remove. not sure how best go doing this.
var remove = null; var caller = null; $(function() { remove = $('#removediv'); $('td').click(function() { caller = $(this).parent('tr'); remove.show(); }); remove.click(function() { caller.remove(); $(this).hide(); }); });
Comments
Post a Comment