cachess
cachess

Reputation: 203

Open popup once the page is load using href

How can I show the popup on page load using href? what I did is to show the popup using href

<a class="btn btn-primary skip popop-btn" href="#popup1">OPEN POPUP</a> if I clicked this link it will show my popup. What I want is to automatically show popup on page load without clicking it?

This is my code for simple jquery.

$(document).ready(function(){
   setTimeout(function(){
      //My function for showing the popup
   },3000);
});

Upvotes: 0

Views: 58

Answers (1)

Ali Nabati
Ali Nabati

Reputation: 21

step1: set id for the a tag step2: trigger the click event

$(document).ready(function(){
   setTimeout(function(){
      $("#linkId").trigger("click");
   },3000);
});

Upvotes: 1

Related Questions