Remo
Remo

Reputation: 389

How can i show a jquery popup on PageLoad??

I am trying to use jquery to open a popup on Pageload. I guess this is what i should use to show the popup after a button click in an Asp.Net application. How do i get the popup on Pageload.

$(document).ready(function(){  

$("#button").click(function(){  

centerPopup();  

loadPopup();  
});  

});  

Thank you in advance!!

Upvotes: 1

Views: 662

Answers (3)

ShankarSangoli
ShankarSangoli

Reputation: 69905

Just trigger the button click handler if you want to use the same code to load the popup on page load.

$(document).ready(function(){  

   $("#button").click(function(){  

    centerPopup();  

    loadPopup();  

  }).click();

}); 

Upvotes: 1

Robert
Robert

Reputation: 8767

You can make it popup on the ready function:

$(document).ready(function(){ 
    centerPopup(); 
    loadPopup(); 
});

Upvotes: 1

Oskar Kjellin
Oskar Kjellin

Reputation: 21860

Just remove the click handler:

$(document).ready(function(){  

centerPopup();  

loadPopup();  

});  

Upvotes: 1

Related Questions