$F(), which does the same thing, given the DOM ID of a form element.
Unfortunately, thinks break down when you start dealing with the antiquated Internet Explorer 5.5. When Prototype tries to grab the value associated with a select list, it checks for the presence of the
value attribute in the
option tag, and if it can’t find it, it returns the contents of the
Prototype provides a method called
hasAttribute, which is included to make up for deficiencies in the DOM implementation in Internet Explorer 6 and 7. It ends with this line:
Unfortunately, Internet Explorer 5.5 also doesn’t support the
getAttributeNode method, either, so
$F() won’t work in Internet Explorer 5.5 (for select lists, anyway).
I guess the easiest solution is to just skip Prototype in this case and grab the value of the select list manually. You can grab the value of the field like this:
This works fine for my page, but obviously it’s not generic.
mySelectList must be a select list, and I have to be using value attributes in my options for this to work. I can’t help but wonder if there’s a more elegant approach that could be integrated into Prototype.