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 specified option

 

I'm doing a related select dropdown here (bottom middle of the page):

http://w3.normreeveshonda.com/pages/page.cfm?pageid=80976
<http://w3.normreeveshonda.com/pages/page.cfm?pageid=80976&pagetype=26&featu
reid=-1> &pagetype=26&featureid=-1

 

In FF, under New vehicles, the Make dropdown defaults to HONDA as desired.
In IE though, it stays on "select a make". Here's the code that I'm passing
back to the page for that select box:

 

<option>select a make</option><option value="HONDA">HONDA</option>

 

Ideally, I'd just do this:

<option>select a make</option><option value="HONDA"
selected="selected">HONDA</option>

 

but that doesn't work for some odd reason. So I'd like to default it to the
first dropdown that has a value attribute. How would I go about that?

 

$('#RedMakeSelect:first-child [EMAIL PROTECTED]')

 

or something like that?

____________________________________

 

Andy Matthews
Senior Coldfusion Developer

Office:  877.707.5467 x747
Direct:  615.627.9747
Fax:  615.467.6249

[EMAIL PROTECTED]
www.dealerskins.com <http://www.dealerskins.com/> 

 

<<image001.gif>>

Reply via email to