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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:35:01+00:00 2026-06-17T04:35:01+00:00

I am having a problem to stop the setTimeout function fired previously. I found

  • 0

I am having a problem to stop the setTimeout function fired previously.

I found some relative questions and the giving solution is to put the time_out variable outside of the function to make it work. I tried but still not working.

   this.A = function(){
        if(time_out) clearTimeout(time_out);  
        // time_out is nothing here and this will return error
        
        time_out = setTimeout(function(){  }, 3000);
    }
    
    -------------------------------------------------

     this.time_out = 0;
     this.A = function(){
          if(this.time_out) clearTimeout(this.time_out);  
          //will run through, but the setTimeout setup previously will keep running...
            
         this.time_out = setTimeout(function(){  }, 3000);
     }

Update

I tired put the whole function into a element and call it out when reset

if(el.data('time_out')) clearTimeout(el.data('time_out'));

This works perfect

  • 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-17T04:35:02+00:00Added an answer on June 17, 2026 at 4:35 am

    make sure you are in the proper scope.

    var timerFun = function(){
         var me = this;
         me.timer= undefined;
    
         me.startTimeout = function(){
            me.timer = setTimeout(me.SetterFunc, 3000);
         };
    
         me.setterFunc = function(){
            alert('oh hai!');
            me.ClearTimer();
         };
    
         me.clearTimer = function(){
            if(me.timer!= undefined){
                me.clearTimeout(me.timer);
            }
         };
         return me;
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a problem where I want to stop a particular function from
hello I am having problem related to https:// . I have used FB.getLoginStatus(function(response) function
I can't believe that I'm having an issue with this. My setTimeout is: setTimeout(function(){showContent(entries,
I'm having a problem with jQuery 1.7's latest on() function. I'm moving all of
I have been having this problem wherein my threads stop execution and go into
I have found other examples of people having this problem but have had no
I am having problem typing character glottal stop into a JTable, and only 0241
I am having a problem with some code. I have looked across the web
i'm currently having a problem tweaking this tooltip plugin. (function($) { $.fn.toolTip = function()
I am having a problem on my viewing function in my desktop application. The

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.