let reset = document.getElementById('reset');
let start = document.getElementById('start');
let pause = document.getElementById('pause');
let seconds = 0;
let timerId;
function updateTime(){
document.getElementsByTagName('h1')[0].innerHTML=seconds;
seconds++;}
// start.on('click', setInterval(updateTime, 1000));
start.click(setInterval(updateTime, 1000));
I want to click on the start button to get the timer to start. As it's written now, my timer starts immediately when I refresh the page, not when I click the start button. The last two lines of the code seem to do the same thing.
One is commented out at the moment, but I'm afraid both are incorrect because the start button does nothing now. I have googled this for hours and have tried this a few different ways (tried onclick too) but I am a new developer and am afraid I'm missing something. I don't know why the timer starts immediately and I don't know how to get it to start when I click on the start button.
When I used onclick, the timer went up every time I clicked on it but not at any set interval. I'm very confused.