i want to call a javascript function from a div every seconds. and i also pass arguments with this function
function myFunc(a) {
alert(a);
setInterval("myFunc(a)", 1000);
}
myFunc(a);
<div myFunc(5)></div>
Try below code where page will be auto refreshed after 1min and that time on page load you are calling your function
var refresh_mili_sec=60000; //60000=1min
$(document).ready(function(){
var a=5;
myFunc(a);
setTimeout(function()
{
window.location.reload(1);
}, refresh_mili_sec);
});
function myFunc(a) {
alert(a);
}
<div myFunc(5)>this doesn't make any sense