views:

48

answers:

3

Hi,

I have this code:

$("#boxId ul li a:eq(0)").click();

Works ok in IE8 and FF, but I'm getting error in IE6 and IE7.

"Object doesn't support this property or method"

Someone knows why?

Obs:

$("#boxFoto ul li a:eq(0)").size(); // returns '1'
A: 

Can you also show us your HTML?

awayken
This should be a comment, not an answer.
Jason
@Jason - Users with <50 rep can't comment.
Nick Craver
@Nick - Shoot. Forgot about that, nevermind that comment.
Jason
Sorry - I can't leave comments yet. Can whoever docked me -1 put it back at 0, please?
awayken
+1  A: 

There's no reason for jQuery's click() to fail on IE. I think the click event is actually triggered, but:

  • You have set an onclick handler on the hyperlink, and it tries to access a property or a method that's undefined under IE, or

  • You have an href="javascript:....." attribute on the hyperlink that has the same problem as above.

Frédéric Hamidi