The code you posted should work normally. But make sure
existingCase.records.Spin_Off__c is a string (and also make sure it
doesnt have trailing whitespace!).
But if it just doesn't work, yeah you can set an option "selected"
explicitly

$("#00N80000002fnHx > option").each(function() {
   if($(this).val() == existingCase.records.Spin_Off__c) {
       $(this).attr('selected','selected')
   }
   // the following part might not be necessary... depends one exactly
what conditions you use it
   elseif($(this).attr('selected') != undefined) {
       $(this).removeAttr('selected')
   }
});


On Dec 15, 5:17 am, raskren <rask...@gmail.com> wrote:
> Yes, I think the markup is valid.  Copy & Pasted below:
>
> <select id="00N80000002fnHx" tabindex="7" name="00N80000002fnHx">
> <option value="">--None--</option>
> <option value="Yes">Yes</option>
> <option value="No">No</option>
> </select>
>
> I do not have control over the markup.  Is there any other way to make
> an option "selected" that will work cross-browser?
>
> On Dec 14, 9:22 pm, "Jeffrey Kretz" <jeffkr...@hotmail.com> wrote:
>
>
>
> > There shouldn't be an issue, so long as "existingCase.records.Spin_Off__c"
> > has a correct value.
>
> > Do your option elements have explicitly defined values?  Like this:
>
> > <option value="Yes">Yes</option>
> > <option value="No">No</option>
> > <option value=""> </option>
>
> > If not, try changing your markup and see if that helps.
>
> > JK
>
> > trouble in Firefox 3.0.4 and Safari 3 - both in Windows.  My code does
> > seem to run properly in IE7.
>
> > Some code:
> > $("#00N80000002fnHx").val(existingCase.records.Spin_Off__c);
>
> > Is this a known issue in these browsers?  Am I doing anything
> > obviously wrong?

Reply via email to