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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:39:56+00:00 2026-05-24T11:39:56+00:00

Here is the functionality simply when click btnGo timer will stop and get it’s

  • 0

Here is the functionality simply when click btnGo timer will stop and get it’s value, if time remaining is not exceed its automatically add +1 to On time total My problem is its not adding it only shows the value below are my codes with live demo

My JS

var sec = $('#timerSec').text() || 0;
var timer;

function startTimer() {
    if (timer) clearInterval(timer);
    sec = 10;
    timer = setInterval(function() {
        $('#timerSec').text(sec--);
        if (sec == 0) {
            clearInterval(timer);
        }
    }, 1000);
}
$(function() {
startTimer();

$('#btnGo').click(function(){
    $(this).fadeOut();
    $("#alert").fadeIn();
    clearInterval(timer);
    var secR = $('#timerSec').text();
    var t = $('#alert span').text()
    $('#btnCon').fadeIn();
    if (secR != 0 ){
    var i = t+1;
    }
    $('#alert span').html(i).show();
});
$('#btnCon').click(function(){
   $("#alert").fadeOut();
    $("#btnGo").fadeIn();
    startTimer();
});


});

My html

<div id="timerSec">10</div> seconds

<a href="#" id="btnGo">Go</a>
<div id="alert" style="display:none">
<a href="#" id="btnCon" >Continue</a>
 On time = <span>0</span>
</div>

Live Demo jsfiddle

  • 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-24T11:39:58+00:00Added an answer on May 24, 2026 at 11:39 am

    I’m not sure it’s functioning as you want it to, but in any case the problem with the addition is that it was treating the text value of the span as a string (which it is). So when you “added” 1 to it, it was actually just concatenating. You can use Number() to fix this. See this updated code.

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

Sidebar

Related Questions

Here is the code (Seam 2, JSF 1.2) <s:link style=color: white; value=Full Listing rendered=#{not
We currently have a form with the standard multi-select functionality of here are the
Here is a quick overview of the controllers functionality in most of the application:
MSDN has the functionality I'm looking for here . Since microsoft recognizes the usefulness
I'm having an issue with one of my controller's AJAX functionality. Here's what I
Fiddle demo available here: http://jsfiddle.net/r9MCW/5/ The functionality Basically, I have a very simple table
jqGrid has a column chooser functionality as like described here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods and a demonstration
Here is the test i wrote and that will currently fail: var unusableColor =
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form

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.