Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7619983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:49:39+00:00 2026-05-31T03:49:39+00:00

I used this button for a while: <input type=button class=button onclick=javascript:history.go(-1) value=Go back to

  • 0

I used this button for a while:

<input type="button" class="button" onclick="javascript:history.go(-1)" value="Go back to previus page" />

And I would like to add feature to it, but I have no clue, since im javascript newb, so please give me some tips or even solution.

I would like that you would get redirected from that page on which this button is located, automaticaly in 10 seconds (timmer should show on the actual button).
OR if you click you get redirected instant?

Any ideas how to do this with jquery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:49:41+00:00Added an answer on May 31, 2026 at 3:49 am

    No jQuery necessary. Put this in your header. It will call history.go(-1) after 10000 milliseconds, or 10 seconds.

    <script type="text/javascript">
          setTimeout( function() {
               history.go(-1);
          }), 10000);
    </script>
    

    I just noticed you want a timer on the button. This could use a little jQuery. While you are at it, you should move your inline javascript onclick="javascript:..." to your script body. Inline javascript has fallen out of favor, mostly because it is a lousy way to do things.

    <script type="text/javascript">
          $( function() {
                 // While you are at it, remove do the click handler here:
                 $(document).on('click', '.button', function() {
                     history.go(-1);
                 })
    
                 // Get button name, init timer value
                 var buttonName = $('.button').val();
                 var time = 10;
    
                 function updateButton() {
                      // Set button name to "Go back to previus page (X)"
                      $('.button').val(buttonName+' ('+time+')');
    
                      if(time <= 0) {
                           // If we reached 0, redirect
                           history.go(-1);
                      } else {
                           //decrement time counter  
                           time--;
                           // otherwise, wait a second and do it again
                           setTimeout(updateButton, 1000);
                      }
                 }
    
                 // Start the counter
                 updateButton();
          });
    </script>
    

    You could use setInterval() also, but this let’s you set the button timer at time 0 a little easier.

    Example: http://jsfiddle.net/jtbowden/gJsPw/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
I have these two elements in my page: <input type='button' value=undo style=display:none onClick =
I used this code for sending and returning result. <script type=text/javascript> $(document).ready(function() { $('.special').click(function(){
Can someone help me understand this line of jquery code?: $(this).find('input[type=submit]:not(.cancel), button').click(function () I'm
I have used this code in my AS3 document class to remove all objects
I encountered a problem while practicing html. When I used parentNode in JavaScript, I
Till this moment I used this method to invoke: public string AddText { set
I used this code in my Android application: import org.apache.http.client.methods.HttpPost; ... HttpClient httpclient =
I used this script to create a jQuery accordion. Check out the working jsFiddle
I used this code previously in netbeans 6.9.1 but it does not seem to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.