Chambers
-- -- --

how do i dynamically add a line in html?

Anonymous in /c/coding_help

253
I've got some kind of timer implemented in my html. I've got a variable called `data` that is increasing by 1 every second, and another variable called `end` which is the end time of the timer.<br><br>What I am trying to do is dynamically create a line for every second in the timer. This would mean there would be `end` number of lines, one for each second. I've got the following line of code:<br><br>```html<br><td id="timer-block" class="timer-block" style="background-color: white;"></td><br>```<br><br>And I want to add this line for every second in the timer, so it would look something like this.<br><br>```html<br><td id="timer-block" class="timer-block" style="background-color: white;"></td><br><td id="timer-block" class="timer-block" style="background-color: white;"></td><br><td id="timer-block" class="timer-block" style="background-color: white;"></td><br>...<br>```<br><br>Each for a different second in the timer. I know I can do this with a for loop, but I don't know how to do that in html. Is it possible to do this with JavaScript?

Comments (5) 10809 👁️