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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -