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

  • Home
  • SEARCH
  • 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 8463047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:21:26+00:00 2026-06-10T14:21:26+00:00

I have written a JQuery program that, on the press of a button, runs

  • 0

I have written a JQuery program that, on the press of a button, runs a dozen or so setTimeout’s as well as a few animations. The program operates on existing div’s, changes their HTML (using id selectors), fades in, fades out, etc…

The entire process can take up to 15 seconds. The problem is that if the button is pressed again within that time frame then the fade ins and outs start piling on top of each other and looking weird.

Is there something that I can use so that if the button is pressed again then all JQuery stuff in progress just stops and is cleared out? I have tried using clearTimeout, which doesn’t seem to work.

  • 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-10T14:21:28+00:00Added an answer on June 10, 2026 at 2:21 pm

    You can either use .stop() or .clearQueue().

    When the .clearQueue() method is called, all functions on the queue that have not been executed are removed from the queue. When used without an argument, .clearQueue() removes the remaining functions from fx, the standard effects queue. In this way it is similar to .stop(true). However, while the .stop() method is meant to be used only with animations, .clearQueue() can also be used to remove any function that has been added to a generic jQuery queue with the .queue() method.

    And you can also prevent the button from doing any actions until the timer is finished.
    You can put a Boolean variable that after the first click get value of false and when the timer is finished, turn this variable back to true and check for it whenever you click the button.

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

Sidebar

Related Questions

I have written a script that fires a jQuery POST to retrieve data from
I have written a cascading drop down list using JQuery. The code that I
I have a modal dialog plugin written in jquery, that binds to the click
I have written a simple jQuery script that changes the hash tag of a
I have written a short jquery method that on the keypress event of a
I have written a jquery ajax function that I have added to js file
I have written a jQuery image resize script that works fine when the images
I have written a few jquery functions for form validation. It works fine but
I have written a bit of jQuery that hides a certain element on page
I have written a jQuery function that is for a treeview that has 5

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.