Subject: [jQuery] Re: trigger click on an anchor




Yes, it's a little different. Calling click() will not do an auto-
mouseclick on the link.
You'd have to do something like:

// set click callback
$("#clickme").click(function() {
location.href = this.href; // goes to link
});

// trigger click callback
$("#clickme").click();


On Jul 13, 7:02 am, "Cesar Sanz" <the.email.tr...@xxxxxxxxx> wrote:
> "trigger" fires inmediatly the event.
> $('#clickme').click(function()....) binds an event to the element.
>
> Both are different..
>
> Just test it.. I must work.
>
> Best regards
>
> ----- Original Message -----
> From: "pedalpete" <p...@xxxxxxxxxxxxx>
> To: "jQuery (English)" <[email protected]>
> Sent: Monday, July 13, 2009 9:55 AM
> Subject: [jQuer...

y] Re: trigger click on an anchor

>
> jQuery doesn't care what you are linking to, as long as that file is
> there, it will be retrieved (I can't think of any reason why not).'
>
> you could use
> $('#clickme').click(function()....
> that would I believe be more efficient
>
> On Jul 13, 8:45 am, sso <strongsilent...@xxxxxxxxx> wrote:
> > if I have a link on my page like this
>
> > <a id="clickme" href="home/download/myfile.pdf">triggerclick</a>
i>
>
> > should I be able to click it with jquery?
>
> > on event {
> > $('#clickme').trigger('click');
>
> > }
>
> > or will it disallow it because its linking to a file
>
>



Programming list archiving by: Enterprise Git Hosting