Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call function only once after page load completely

I want to call function one second after the page is completely loaded

$(window).bind("load", function() {
  window.setInterval(function(){ your_func(); }, 1000);
});

It calls every second. I want it to be executed only once

like image 449
Ketan Borada Avatar asked Dec 20 '25 17:12

Ketan Borada


1 Answers

You can use $(document).ready();

$(document).ready(function() {
  setTimeout(function() { your_func(); }, 1000);
});
like image 52
Bhavin Solanki Avatar answered Dec 23 '25 08:12

Bhavin Solanki