i have a drop down list in my html with values show here,
<select id="thedropdown">
<option value="1">test1</option>
<option value="2" selected="selected">test2</option>
<option value="3">test3</option>
</select>
And my javascript:
function myFunction()
{
var a = document.getElementById("thedropdown");
var b = a.options[a.selectedIndex].value;
var y=b;
var x=y+2;
var demoP=document.getElementById("demo")
demoP.innerHTML= x;
}
However the answer when i click the button makes it 22 when it should be 4. you can see my problem. Cheers for help in advance