Jump to content

Disable search result page

Recommended Posts

Hi, I am creating a multilingual site. In which I had created 2 blogs with different languages. 
I am using a search bar for the blog posts. I would like to disable the search result page redirection after hit "Enter" key.
So I don't have to inject more code to make it looks multilingual.

Is there : 
1) A way to stop redirect to search result page after hit "Enter" key?
2) I had try to disable "Enter" with code injection in the blog page. The if-else statement is working as expected, but "Enter" key is still working. Where I did wrong?

$(document).ready(function() {
    $('.sqs-block-search').on('keypress keydown keyup', function(e){
      if(e.keyCode == 13) { 
        e.preventDefault(); }
    });
  });

3) Is there a way to inject slug (e.g. /en ) in the URL of search result page, so it can be multilingual?

Many thanks.

Link to comment
  • Replies 1
  • Views 502
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.