Jump to content

Recommended Posts

Posted

Hi, i have a link in the php file which i want it to get clicked when the page has been load. I am using jquery. look the code

 

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

 

and this link

 


<a href="http://www.google.com" id="pdf">Google</a>

 

Any suggestions?

Posted

I looked into this just recently, and really didn't find a clean solution. I'm pretty sure the code you posted above won't work the way you anticipate -- you also need a section like this:

 

$('#pdf').click(function(){

...code here...

});

 

One way around it that I found, though, is using jquery to parse the link, return the href value, and use window.location to change the page.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...