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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:11:05+00:00 2026-05-23T13:11:05+00:00

I am adding new features to my already developed application. I am trying to

  • 0

I am adding new features to my already developed application. I am trying to add an auto rendering functionality which automatically render some part of the screen after a certain time interval. I am using setInterval for this, everything is working fine.

My question is, how should I call the clearInterval(intervalId) function for all other events except one. Please consider an example:
Suppose I have some events related to current screen, and I want to start my setInterval only on “.myBtn” click and stop for all other events.

    var intervalId = 0;

    $(".myBtn").click(function(){
        intervalId = setInterval(function(){
          alert("execute something");
        }, 2000);  
    });

   $(".otherElm").click(function(){
      // some other stuff.
   });


   $(".otherElm1").click(function(){
      // some other stuff.
   });


   $(".otherElm2").click(function(){
      // some other stuff.
   });

For the above situation, I know only one way to stop the interval i.e. to put “clearInterval(intervalId)” in every other event.

But, is there any other way to do this?

Hope I have put everything so that one can understand my question.

Thanks in advance

  • 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-23T13:11:05+00:00Added an answer on May 23, 2026 at 1:11 pm

    You are right in your comment – you have to put clearInterval(IntervalId) into all of the events that you require to stop the event. Is there a problem with doing this?

    Edit:

    Identify them all with a class – say elm. Once this is done, use $(“.elm”).click(clearinterval).

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

Sidebar

Related Questions

I need to add some new functionality to an existing interface. There are already
How can I prevent users from adding new tags which don't already exist in
I'm adding new features to a legacy application written in PHP that uses an
I'm adding a new field to a list and view. To add the field
I'm currently adding some new extended classes to this code: foreach (BaseType b in
I have been tasked with fixing bugs and adding new features to a website
When adding new properties to classes, I find myself typing the same things over
Using the Qt Visual studio integration, adding a new Qt class adds two separate
When adding an EditItemTemplate of some complexity (mulitple fields in one template), and then
I'm creating OSM map in my web site and adding some markers with openlayer..

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.