i don't understand why it is not taking value, it is giving type-error cannot take null value in console log
var seconds = parseInt(document.getElementById('secs').innerHTML);
var timer;
function countdown() {
var container = document.getElementById('dl');
seconds--;
if (seconds > 0) {
container.innerHTML = 'Please wait <b>' + seconds + '</b> seconds..';
} else {
container.innerHTML = 'Time over';
clearInterval(timer);
}
}
<!-- <div id="dl"></div>
<input type="button" onclick="setInterval(countdown, 1000);" id="dl" value="Start" /> -->
<input type="text" id="secs" placeholder="enter seconds" />
<input type="button" onclick="setInterval(countdown, 1000);" id="dl" value="Start" />
<div id="dl"></div>