Call a function every second or 5 seconds in javascript

22-02-2017 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:

Sanitization in java sript
14-03-2017 sanitization java script
How to get current date and time (yyyy-mm-dd H:i:s) using javascript
09-03-2017 javascript date time
Filter for insert HTML in Angular Js
06-03-2017 filter show html angular js html
How to get drop down value when drop down change using javascript
27-02-2017 onchange events dropdown javascript functions
How to remove last / value from url in javascript
27-02-2017 array javascript last value