I am trying to show divs based on input from a dropdown menu.
<script type="text/javascript">
function display_div(show){
document.getElementById(show).style.display = "";
}
</script>
<select name="passengers" id="passengers">
<option selected="selected"> </option>
<option onclick="display_div('passenger1');">1</option>
<option onclick="display_div('passenger2');">2</option>
<option onclick="display_div('passenger3');">3</option>
</select>
Nothing happens when I select an option. What am I doing wrong here?
Ok after thinking back to some old problems i had, i remembered a problem that IE and Chrome have with the onClick event.
The solution was to make the function call on the select and use onchange. Then it gets the selected options value and gives it to the function to work its magic