Possible Duplicate:
Why does jQuery or a DOM method such as `getElementById` not find the element?
I'm sure this is obvious, but 2 hrs of head banging. Trying to get the value from each of my Select boxes:
<table>
<tr><td>Team</td><td>Games</td><td>Players</td></tr>
<tr><td><div id="selTeam">
<select name="teams" id="teams" onChange="sndReq(this)" >
<option value="-1">-- Not Set --</option>
</select>
</div></td>
<td><div id="selGames">
<select name="games" id="games" onChange="sndReq(this)" )" >
<option value="-1">-- Not Set --</option>
</select>
</div></td>
<td><div id="selPlayers">
<select name="players" id="players" onChange="sndReq(this)" )" >
<option value="-1">-- Not Set --</option>
</select>
</div></td></tr>
</table>
Here is the javascript I am using, the getElementById keeps returning a null.
var selbox = document.getElementById("teams");
var idx = selbox.selectedIndex;
var teamValue = selbox.options[idx].value;
var selbox = document.getElementById("games");
var idx = selbox.selectedIndex;
var gameValue = selbox.options[idx].value;
var selbox = document.getElementById("players");
var idx = selbox.selectedIndex;
var playerValue = selbox.options[idx].value;
I'm trying not to use JQuery.
Thanks!