I just saw the following: http://www.w3schools.com/jsref/prop_option_value.asp
And wonder if there's something wrong with selectObject.value. Why not a simple approach:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function displayResult(){
alert(document.getElementById("mySelect").value);
}
</script>
</head>
<body>
<form>
Select your favorite fruit:
<select id="mySelect">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
<option value="pineapple">Pineapple</option>
<option value="banana">Banana</option>
</select>
</form>
<button type="button" onclick="displayResult()">
Display value of selected fruit
</button>
</body>
</html>
It seems to be working with no problem.
Thanks in advance!
Mike
<select>inputs.selectedIndexwhen getting aselects value. However, reviewing MDN's information onselectproperties, it appears I was wrong and it is available for accessing the (first)optionelement's selected value. Am I missing something, or was I just lead astray? Now I'm wondering if theselectedIndexwas was meant for accessing multi-selectvalues. Anybody care to disabuse me, please be my guest. Also, MDN is a legitimate resource for learning.