Use delegated event handler to delete tax rows

When a tax row is dynamically inserted, it can not be dynamically
deleted until the page is refreshed (becasue the event handler is
bound to only on page load). This commit delegates the event handler
from an element which is guaranteed to exist on page load, so that
dynamically inserted tax rows can also be dynamically deleted.
This commit is contained in:
Brent Shepherd 2013-01-25 13:22:44 +10:00
parent 5c3c54d3ff
commit 1a9ca48422
1 changed files with 1 additions and 1 deletions

View File

@ -853,7 +853,7 @@ jQuery( function($){
}); });
// Delete a tax row // Delete a tax row
$('a.delete_tax_row').click(function(){ $('#tax_rows').on('click','a.delete_tax_row',function(){
$tax_row = $(this).closest('.tax_row'); $tax_row = $(this).closest('.tax_row');
var tax_row_id = $tax_row.attr( 'data-order_item_id' ) var tax_row_id = $tax_row.attr( 'data-order_item_id' )