Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute javascript function after 5 seconds [duplicate]

I have this function, which I would like to be executed after 5 seconds:

$(document).ready(function() {
   $("#signInButton").trigger('click');

  });

Thank you

like image 654
Jonathan Etienne Avatar asked Apr 16 '15 13:04

Jonathan Etienne


2 Answers

Use setTimeout() function:

$(document).ready(function() {
  setTimeout(function() {
    $("#signInButton").trigger('click');
  }, 5000);
});
like image 82
kapantzak Avatar answered Oct 13 '22 08:10

kapantzak


Use setTimeout()

$(document).ready(function() {
  setTimeout(function() { 
    $("#signInButton").trigger('click');
  }, 5000); // for 5 second delay 
});
like image 26
prog1011 Avatar answered Oct 13 '22 08:10

prog1011