[jQuery] Re: Setting option to selected

2008-04-14 Thread Rey Bango
That did the trick Karl. Thanks for your help! :D Rey Karl Rudd wrote: As far as I know you can't use anything but a simple number with the ":eq()" selector. You could rewrite the code as: $( "select#cert_id option:eq(" + (i > 1?1:0) + ")" ).attr( "selected", true ); Note how the terna

[jQuery] Re: Setting option to selected

2008-04-14 Thread Karl Rudd
As far as I know you can't use anything but a simple number with the ":eq()" selector. You could rewrite the code as: $( "select#cert_id option:eq(" + (i > 1?1:0) + ")" ).attr( "selected", true ); Note how the ternary operator is "outside" the selector string, it's just used to produce a 1