Jump to content

Count up appear in Textbox


Recommended Posts

I would appreciate if someone could figure this out or tell me the easiest way to do this. I need a count up counter that appears in a textbox so I can record the time a user is on a page. On a side note, I do have their Start and finish time timestamp recorded in myphpadmin database but I am looking for the easiest (or best) way to do this. Any advice or scripts would be very much appreciated.


Thanks in advanced.


I did find this counter that works but the numbers appear 0.0.1 if counting up. I don't want to confuse the user. I really want to display to the user how long they was on a certain page.

  $(document).ready(function() {
    var time = '00:00:00',
        parts = time.split(':'),
        hours = +parts[0],
        minutes = +parts[1],
        seconds = +parts[02],
        input = $('#timeInput');
    var timer = setInterval(function(){
        if(seconds == 60) {
            seconds = 00;
            if(minutes == 60) {
                minutes = 00;
        var newTime = hours + ":" + minutes + ":" + seconds;
    }, 1000);
<input type="text" name="time" id="timeInput"/>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.