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:

How to convert html to pdf in Node js

12-03-2017 pdf convert html node js

Navigate to another page using java script

06-03-2017 javascript redirection navigation

Filter for insert HTML in Angular Js

06-03-2017 filter show html angular js html

Filter for change Date Time format (MM-dd-yyyy HH:mm) in Angular Js

05-03-2017 mm-dd-yyyy HH:MM date formats angular js

How to set or update or push the values into Object in javacript

27-02-2017 javascript set update push object