tags:

views:

79

answers:

2

Hello,

I have a dropdown which lists heights, like this:

5' 9"
5' 10"
5' 11"
6' 0"

Etc.

When I view source, it looks like this:

<option value="5' 9&quot;">5' 9&quot;</option>
<option value="5' 10&quot;">5' 10&quot;</option>
<option value="5' 11&quot;">5' 11&quot;</option>
<option value="6' 0&quot;">6' 0&quot;</option>

How can I set the selected value of my dropdown box via Javascript when those characters are in there?

I tried:

document.GetElementById("myDDL").value = '5\' 11\"';

However that is not working and I'm just taking stabs in the dark.

Thank you!

+2  A: 

Works fine for me on Safari 4, MobileSafari 3.1, Firefox 3.5 and Opera 10.10

Did you try

document.getElementById("myDDL").value = '5\' 11"';

with a small g?

KennyTM
A: 

If you know in advance which option you want to select, you could do

document.getElementById("myDDL").selectedIndex = 2; // 5' 11"
Tim Down