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:

Example for Conditional Operator in php

16-04-2017 php Conditional Operator example

How to upload file by using request module

18-03-2017 request module node js

Filter for insert HTML in Angular Js

06-03-2017 filter show html angular js html

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

27-02-2017 css javascript colors

How to remove last / value from url in javascript

27-02-2017 array javascript last value