Great. Two people suggesting the same solution. I'll give that a shot. Thanks you two.
_____ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh Nathanson Sent: Wednesday, May 02, 2007 1:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Force the FIRST option to be selected in a select box. Andy, try this: $("option:first","#select-id").attr("selected",true); -- Josh ----- Original Message ----- From: Andy <mailto:[EMAIL PROTECTED]> Matthews To: jquery-en@googlegroups.com Sent: Wednesday, May 02, 2007 11:45 AM Subject: [jQuery] Re: Force the FIRST option to be selected in a select box. Hrm... That didn't seem to work. For some reason FF is selecting the last option tag. So for the time being I just placed a dummy option at the end. I'll come back and fix it later. _____ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rob Desbois Sent: Wednesday, May 02, 2007 10:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Force the FIRST option to be selected in a select box. Andy, <option selected="selected"> and <option selected> both work fine for me in FF2.0.0.3 under HTML 4.01 strict. Can you post a link to the page? Without trying I'm not sure off-hand how to use jQuery for selection, although IIRC using the DOM I tihnk this should work (untested): var select = $("#select-id"); select[0].selectedIndex = 0; Rob On 5/2/07, Andy Matthews <[EMAIL PROTECTED]> wrote: I've got two related select dropdowns. Makes: Honda, Ford, Acura, etc. Models: select a make first To cover the possibility of the first dropdown only having one value, I'm auto-selecting the first value in the list. in this case, it's Honda. That in turn loads 2 vehicles into the Models dropdown (2007 Accord, 2007 Civic). The loading part works just fine, but in FF, the last option is selected (2007 Civic) instead of the first one (--please select a model--). I've tried dropping in a <option selected="selected">, I've tried <option selected> and neither of them are working correctly. So what I'd like to do is to force the first option to be selected using jQuery. I'm not sure how to do this though. Anyone have an idea? ____________________________________ 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/> -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
<<attbda50.bmp>>