Reputation: 477
I have this countdown timer, and once it reaches 0, I want it to show div, which is currently set to: display: none;
Here is the countdown code:
function startTimer(duration, display) {
var timer = duration,
minutes, seconds;
setInterval(function () {
minutes = parseInt(timer / 60, 10)
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = minutes + " min " + seconds + " sec";
if (--timer < 0) {
display.textContent = "Yay, It's done!"
}
}, 1000);
}
window.onload = function () {
display1 = document.querySelector('#time1');
startTimer(1 * 5, display1);
};
At this part:
if (--timer < 0) {
display.textContent = "Yay, It's done!"
how would I make it also show hidden div, after showing that text?
Upvotes: 0
Views: 137
Reputation: 6812
Plain JS
document.getElementById('myID').style.display = "block";
JQuery
$('#myID').fadeIn();
Upvotes: 1
Reputation: 9691
You would set its display to block.
elementYouWantToShow.style.display = 'block';
Upvotes: 1