I would like to unhide all elements inside certain class on a webpage according to a chosen time written in the class.
For example:
class=".unhide15"should unhide the element after 15 seconds.class=".unhide123"should unhide the element after 123 seconds.
And so on..
I arrived to this code below (it works), but I still can't chose any time I want.
<style>
.unhide15, .unhide30, .unhide60{
display:none;
}
</style>
<script>
setTimeout(function(){
[].forEach.call(document.querySelectorAll('.unhide15'), function (el) {
el.style.display = 'block';
});
}, 15000);
setTimeout(function(){
[].forEach.call(document.querySelectorAll('.unhide30'), function (el) {
el.style.display = 'block';
});
}, 30000);
setTimeout(function(){
[].forEach.call(document.querySelectorAll('.unhide60'), function (el) {
el.style.display = 'block';
});
}, 60000);
</script>
Any thoughts on how to do this?