can you tell me what's wrong with my code?
I've got this dropdown list:
<select name="mySelect" id="mySelect" onchange="getSelectedValue();">
<option value="1">Text 1</option>
<option value="2">Text 2</option>
And the following script:
function getSelectedValue() {
var index = document.getElementById('mySelect').selectedIndex;
var index = document.getElementById('mySelect').value;
return index;
}
function passValue(x){
var a = x;
alert(a);
}
passValue(getSelectedValue());
The getSelectedValue function works fine, but when I try to pass the value it returns to the passValue function nothing happens. What am I doing wrong here?