Skip to content

Instantly share code, notes, and snippets.

@kaskad88
Last active September 10, 2020 10:10
Show Gist options
  • Save kaskad88/3446091b83a52d20de34b6f5dbe9d2dd to your computer and use it in GitHub Desktop.
Save kaskad88/3446091b83a52d20de34b6f5dbe9d2dd to your computer and use it in GitHub Desktop.
(function($) {
'use strict';
$( document ).ready(function() {
$( '.jet-ajax-search__form' ).on( 'submit', function( event ) {
event.preventDefault();
var $form = $( this ),
action = $form.attr( 'action' ),
$inputs = $form.find( '[name]' ),
url = '';
url += action + '?';
$inputs.each( function() {
url += $( this ).attr( 'name' ) + '=' + encodeURIComponent( $( this ).val() ) + '&';
} );
window.open( url, '_blank' );
});
});
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment