I’ve been looking at this code:
http://www.jquery4u.com/jquery-date-and-time-2/online-jquery-stopwatch/
I’m trying to understand exactly how it is working because I’d like a timer on a page I’m working on.
I can’t for the life of me work out where the value of the timer is added to the input “disp” and how I could put this into a regular text, not a form input.
The only thing I can see that refers to it is:
t[6]=document.getElementById('disp');
Can anyone help me understand this please,
Thanks
You’ve correctly identified that they use t[6] to refer to the HTML element. But to set it, earlier on there is:
Since
t[6]is the form input, they set thevalueof the form input to the formatted time. If you wanted to use some other element, e.g.<div id="myTime"></div>, you could say instead:Which changes only the last line, so that you may set the text of your
div.