From d5dd12a8f7b3c5f01a487ff93e4e773536ab2a4d Mon Sep 17 00:00:00 2001 From: George Stephanis Date: Fri, 7 Aug 2015 15:47:26 -0400 Subject: [PATCH] The name resetter should also be run after each render. --- assets/js/admin/settings-views-html-settings-tax.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js index 1caa09f1e2c..77268029be8 100644 --- a/assets/js/admin/settings-views-html-settings-tax.js +++ b/assets/js/admin/settings-views-html-settings-tax.js @@ -33,6 +33,11 @@ source: data.states, minLength: 3 }); + + // Postcode and city don't have `name` values by default. They're only created if the contents changes, to save on database queries (I think) + $tbody.find( 'td.postcode input, td.city input').change(function() { + $(this).attr( 'name', $(this).data( 'name' ) ); + }); } renderTableContents( data.rates ); @@ -125,12 +130,5 @@ return false; }); - /** - * Postcode and city don't have `name` values by default. They're only created if the contents changes, to save on database queries (I think) - */ - $('.wc_tax_rates td.postcode, .wc_tax_rates td.city').find('input').change(function() { - $(this).attr( 'name', $(this).attr( 'data-name' ) ); - }); - }); })(jQuery, htmlSettingsTaxLocalizeScript, wp);