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

Navigate to another page using java script

06-03-2017 javascript redirection navigation

How to get drop down value when drop down change using javascript

27-02-2017 onchange events dropdown javascript functions

Call a function every second or 5 seconds in javascript

22-02-2017 setinterval function calling