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:

Check null values in JavaScript?

04-02-2019 JavaScript null check null value

Example for Conditional Operator in php

16-04-2017 php Conditional Operator example

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 change background color and color to the text using javascript

27-02-2017 css javascript colors

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

27-02-2017 onchange events dropdown javascript functions