I got a problem with this code below.
I want to choose between 2 options. When i choose "1"
, then F1()
is called. When choose "2"
, then F2()
is called.
Unfortunately something is wrong with my code.
function abc(element){
var value1 = element.options[element.selectedIndex].value;
switch(value1){
case 1:
F1();
break;
case 2:
F2();
break;
}
}
<select id = "nextGeneration" onchange="abc(this)" >
<option value="1">1</option>
<option value="2">2</option>
</select>