1

I have a problem regarding displaying the next page on a Website. I use jQuery and want to Display the next Page if the Enter key is pressed? How can I accomplish that. The code below shows already what I have written. Is there any method that will do fine?

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>

<script>

    $(document).on("keypress", "input", function(e){

        if(e.which == 13){



        }

    });

</script>
Mouneer
  • 12,827
  • 2
  • 35
  • 45
Dalaro
  • 33
  • 4
  • Is there a "next page" button on the website? If so, could you inspect element on it and see what it's calling when it's clicked? Cheers – James m May 26 '19 at 13:34
  • Unfortunatly not because the Code run on ab website where we can´t create own buttons – Dalaro May 26 '19 at 13:36
  • Okay no worries, what type of webpage is it? I'm just wondering what would normally trigger a "next page" so we can try and replicate that in code – James m May 26 '19 at 13:37
  • 1
    One approach is the using the History API. This is also commonly used on SPAs. – Aaron3219 May 26 '19 at 13:38
  • Its called Socisurvey a website for psychological surveys which allows you to write own Html Code but limted for security reasons. – Dalaro May 26 '19 at 13:39
  • What is "next page" referring to? Do you have some sample code for that? – 10101010 May 26 '19 at 14:31
  • look at [the answers to a similar question](https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage). Also look a this [solution on codeproject](https://www.codeproject.com/Questions/1111895/Create-next-previous-HTML-page-navigation-with-jqu) Setting the window.location is the basis of both answers.. – Rachel Gallen May 26 '19 at 14:40

2 Answers2

0

you can use window.location for redirect to another page:

window.location = "http://www.google.com" // set your next page url instead of www.google.com
Mojtaba
  • 173
  • 7
0
           window.location.replace("http://stackoverflow.com"); or

           window.location.href = "http://stackoverflow.com"; or

           window.open(url, '_blank');
Palak Jadav
  • 1,202
  • 1
  • 11
  • 23