Trying to delete the currently focused input's tr
I have a form inside a table and i want to be able to delete a detail row from the form. The user should click on the text field and click on the 'delete detail record' button on the toolbar and delete the whole row. The delete button has a class '
deleteRow', the table has a class
'tableAddRow'. Here's my code so far and its not working:
- var focus;
$("input[type='text']").live('focus', function () {
focus = $(this);
});
$(".deleteRow").click(function() {
$("input[type='text']").each(function(event){
if (event.type == $(focus)) {
$(this).parent().parent().remove();
}
});
});
I want to capture the 'focus' event and use it to check which text field is selected to be deleted. I also want the functionality to be available for dynamically added rows. Any help? 