14 December 2006

WTF? with Select object assignment

Okay, what the hell.

Can you, or can you not, assign a value to a select object by using "[element].value = [value to assign]"? It apparently works in both IE and Firefox, but not all the time...

What I'm starting to see is that if you use a "lazy" select object -- for example:

<select>
<option>text #1</option>
<option>text #2</option>
</select>

-- you can assign a value using the above method (the select object UI will reflect the change by switching to that value), but if you use a "proper" select object -- for example:

<select>
<option value="value #1">text #1</option>
<option value="value #2">text #2</option>
</select>

-- the above assignment method will work in IE, but not in Firefox.

Once again, I wonder what the standard says?

No comments:

Post a Comment