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 9215635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:14:53+00:00 2026-06-18T02:14:53+00:00

Basically what I am trying to do is Click on a link, have it

  • 0

Basically what I am trying to do is Click on a link, have it change, then by itself, change back. Below, is the current code I am using. This code was found on here but I couldn’t find out how to add the setTimeout() to the function.

function changeText(idElement) {
var element = document.getElementById('element' + idElement);
if (idElement === 1) {
    if (element.innerHTML === 'Request') element.innerHTML = 'Request Submitted!';
    else {
        element.innerHTML = 'Request';
    }
  }
}

Now, That is allowing them to click on that link, change it to ‘Request Submitted!’ and then click it again to change it back to ‘Request’. How could I put a timer on it to have it switch back to ‘Request’ automatically?

Thanks!

  • 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-06-18T02:14:54+00:00Added an answer on June 18, 2026 at 2:14 am
    function changeText (idElement, reset) {
        var element = document.getElementById('element' + idElement);
        if (idElement === 1) {            
            var newText = (element.innerHTML === 'Request' && !reset) ? 'Request Submitted!' : "Request";
            element.innerHTML = newText; 
            if (element.timer) {
                window.clearTimeout(element.timer);
            }
            if (newText !== 'Request') {
                element.timer = window.setTimeout( function(){ changeText(idElement, true); }, 1000); };   
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my code and I have been trying to color the cells but
Hey I have the below javascript code with accompanying HTML. I am trying to
I've been trying to get a sort of rudimentary filter working. Basically, you click
I'm basically trying to extract a Mac application from a zip file using QuaZip.
I have been trying the new Router and the new Ember code (Version: v1.0.0-pre.2-366-g4772b18),
I'm trying to build a jquery dropdown menu, basically I have the left navigation
Basically I have different images for different months in the year, what I'm trying
I am trying to have a panel slide open and close on click of
I'm trying to get data from a database if a link is clicked. Basically
i am trying to fix a bit of broken code here. basically its a

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.