Remove race condition

This commit is contained in:
claudiulodro 2017-07-11 13:21:42 -07:00
parent fd1cb2d67f
commit 4c4526424a
1 changed files with 5 additions and 5 deletions

View File

@ -273,15 +273,15 @@ class WC_Widget_Layered_Nav extends WC_Widget {
echo '</form>';
wc_enqueue_js( "
// Submit form on change if standard dropdown.
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . ":not([multiple])' ).change( function() {
jQuery( this ).closest( 'form' ).submit();
});
// Update value on change.
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . "' ).change( function() {
var slug = jQuery( this ).val();
jQuery( ':input[name=\"filter_" . esc_js( $taxonomy_filter_name ) . "\"]' ).val( slug );
// Submit form on change if standard dropdown.
if ( ! jQuery( this ).attr( 'multiple' ) ) {
jQuery( this ).closest( 'form' ).submit();
}
});
// Use Select2 enhancement if possible