Hey Sean,
The problem you're experiencing is that you can't trigger (no browser
support) the default link action via javascript. .click() will trigger the
"onclick" event but not the default you're expecting.
Cheers,
-Jonathan
On 1/5/07, Sean O <[EMAIL PROTECTED]> wrote:
Hey Chris,
Tried replacing $(function() { with $(document).ready(function(){, but
both
have same effect (no clicky).
It's that user mouse-clicking (or any other way to simulate the activation
of that <a> tag) that I'm after.
________
SEAN O
Christopher Jordan-2 wrote:
>
> Have you tried $(document).ready(function(){
> // put the code to display your image here
> });
>
> Someone correct me if I'm wrong, but .click() is specifically tied to
> the user clicking the mouse button.
>
> I think the document ready code above is the sort of thing you're
> looking for.
>
> Hope this helps!
>
> Cheers,
> Chris
>
> Sean O wrote:
>> Hi,
>>
>>
>> I'm trying to simulate a click of a link on my page. (to open a jpg in
>> greybox on page load)
>> How do I do it?
>>
>> I tried click(), but it doesn't seem to do anything.
>>
>> $(function() {
>> $("#imglink").css("background","yellow").click();
>> });
>>
>> <a rel="gb_image[]" href="myimg.jpg" id="imglink">My
>> Image</a>
>>
>> The background changes (for testing), but the click event is not
>> triggered.
>> Tips?
>>
>>
>> Thanks,
>>
>> ________
>> SEAN O
>>
>
> --
> http://www.cjordan.info
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/Any-way-to-trigger-a-click-by-script--tf2926200.html#a8180780
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/