Reposition when autocomplete is triggered.

Also, instead of searching through the whole dom, only search in the
tbody.
This commit is contained in:
George Stephanis 2015-08-07 15:29:56 -04:00
parent 536402c183
commit 37f10c18cd
1 changed files with 12 additions and 9 deletions

View File

@ -12,6 +12,18 @@
$.each( data.rates, function ( id, rowData ) {
$tbody.append( rowTemplate( rowData ) );
} );
// Initialize autocomplete for countries.
$tbody.find( 'td.country input' ).autocomplete({
source: data.countries,
minLength: 3
});
// Initialize autocomplete for states.
$tbody.find( 'td.state input' ).autocomplete({
source: data.states,
minLength: 3
});
});
$('.wc_tax_rates .remove_tax_rates').click(function() {
@ -97,13 +109,4 @@
$(this).attr( 'name', $(this).attr( 'data-name' ) );
});
$( 'td.country input' ).autocomplete({
source: data.countries,
minLength: 3
});
$( 'td.state input' ).autocomplete({
source: data.states,
minLength: 3
});
})(jQuery, htmlSettingsTaxLocalizeScript, wp);