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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:55:47+00:00 2026-06-06T18:55:47+00:00

My website works in a way so that any links clicked do not load

  • 0

My website works in a way so that any links clicked do not load a new page but however trigger a .load() event into a div named “content”.

Everything has been nice and dandy but now I have run into a small problem.

On one of the content pages, I have the following code:

    $('.count').each(function () {
        $this = $(this);
        countdown = setInterval(function(){
            countnow = parseInt($('.remain', $this).html());
            $('.remain', $this).html(countnow-1);
        }, 1000);
        return false;
    });

The code works… it works very well. But when I load that same page again, it seems like the code is running twice because the seconds are going down by 2 at a time. Then when I load it again, it’s going down by 3 seconds at a time. Another load, and it goes down by 4 seconds at a time. I load it a couple more times and it goes down faster then I can read.

I tried giving the .count divs their own unique id’s (the .remain div is nested inside the .count div), even when pages are subsequently loaded the id is still entirely different and this did not fix my problem. I also tried putting clearInterval(countdown) right before the function but that just made it stop working entirely. Any suggestions?

And yes I know the countdown doesn’t currently stop when it reaches 0.

  • 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-06T18:55:49+00:00Added an answer on June 6, 2026 at 6:55 pm

    Try this:

    var countdown;
    $('.count').each(function () {
        $this = $(this);
        if (!countdown) 
            countdown = setInterval(function(){
                countnow = parseInt($('.remain', $this).html());
                $('.remain', $this).html(countnow-1);
            }, 1000);
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ecommerce website that works in a classical way: people sign up,
My Zend based website works perfectly on my localhost (using Mac). But When I
I've designed a website that works through my own PC. I set the IIS
I have an existing website that works with my custom theme. Unfortunately, it does
I have an ASP.NET MVC website that works in tandem with a Windows Service
I have almost created a website that works in all major browsers flawlessly. Yesterday,
here is my question: I've a website that works only during the night (after
I'm creating a mobile website that will include a page from which people can
I have been trying to make my website performs well. One way that may
i'm working on some website that has a section with pure AJAX, but i

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.