javascript setTimeout()

js:


setTimeout(function () {

    var target_element = document.querySelector('.target-timeout');

    target_element.innerHTML = '5 seconds passed';

}, 5000);

html:


<h3>wait for 5 seconds</h3>

<h3 class="target-timeout"></h3>

Leave a Comment