Call a function every second or 5 seconds in javascript

setinterval
function calling

call a javascript function every 5 seconds continously.  You can use setInterval(). The below code is working from onload.

setInterval(test,5000);
function test()
{
	alert("hi");
}

 

 

You might also like:

Convert and download html to pdf without saving file

28-10-2018 node js convert html to pdf pdf download pdf without saving

Detect AdBlock with JavaScript in my browser

30-07-2017 AdBlock javascript detect

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

How to get current date and time (yyyy-mm-dd H:i:s) using javascript

09-03-2017 javascript date time

How to change background color and color to the text using javascript

27-02-2017 css javascript colors