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:

Use java script file client side and server side at a time in node js

30-07-2017 node js include call javascript

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

09-03-2017 javascript date time

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

Sample Validations in javascript

22-02-2017 validations javascript

Get random strings from given string In javascript

21-02-2017 javascript random string