[jQuery] Re: Forcing a select box to select a specified option

2007-05-30 Thread Andy Matthews
Hrm... That doesn't work. I think you might have misunderstood me though. I want to force the selected attribute of the second option element. I tried this too: $('#RedMakeSelect:first-child option:nth-child(1)').attr('selected','true'); And that didn't work either. -Original

[jQuery] Re: Forcing a select box to select a specified option

2007-05-30 Thread Andy Matthews
That did it Dan. Thanks! -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Wednesday, May 30, 2007 8:56 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Forcing a select box to select a specified option Andy,

[jQuery] Re: Forcing a select box to select a specified option

2007-05-29 Thread Jeffrey Kretz
I've done it this way: $('#selectid')[0].options[1].selected = true; JK _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Tuesday, May 29, 2007 2:46 PM To: jquery-en@googlegroups.com Subject: [jQuery] Forcing a select box to select a

[jQuery] Re: Forcing a select box to select a specified option

2007-05-29 Thread Dan G. Switzer, II
Andy, $('#RedMakeSelect:first-child [EMAIL PROTECTED]') I believe IE always has the value attribute defined--even if it's not defined in your markup (ie. it essentially adds a value= to your tag.) If you know the 2nd element should have a value attribute if it's present, then I'd just do: