PrestaCraft on Facebook

Please like our page on Facebook to get notifications about new tutorials :)


PrestaCraft

PrestaCraft on Facebook

Please like our page on Facebook to get notifications about new tutorials :)


PrestaCraft

This “issue” happens when you type something in your search input field.

After seeing list of matching products (which appears under that field), you select something using your mouse and hit ‘Enter’.

Instead of going to the search results, the search engine acts like you’ve selected a product from a list.
Let me show you how to deal with it via simple trick.

Solution for this is quite simple. We need to catch a moment when ‘Enter’ key is pressed and prevent from executing any next javascript actions – and just send a form.

Edit: js/jquery/plugins/autocomplete/jquery.autocomplete.js

Find:

lastKeyPressCode = event.keyCode;

Add after:

if(lastKeyPressCode == 13) {
    $("#searchbox").trigger('submit');
    return false;
}

In jQuery each key has its own code number. ‘Enter’ key is 13.

That’s why we are here catching if last pressed key code is belonging to 13. If so, we prevent any further action and submit a form programatically.

Warning: Undefined array key "comment" in /usr/home/kamilgoralczyk/domains/prestacraft.com/public_html/wp-content/themes/appy/functions.php on line 75

Leave a comment

Your email address will not be published.

Be the first to post a comment!

Warning: Undefined array key "comment" in /usr/home/kamilgoralczyk/domains/prestacraft.com/public_html/wp-content/themes/appy/functions.php on line 75

Leave a comment

Your email address will not be published.