Reset combox box in html with given index
<select id="myCombo" onchange="moreOptions()">
<option value="-1" selected="selected">Select options</option>
<option id=" myCombo _1" value="1">One</option>
<option id=" myCombo _2" value="2">Two</option>
<option id=" myCombo _3" value="3">Three</option>
</select>
Javascript to reset onChange() method...
function moreOptions(){
var selectedOption=document.getElementById(" myCombo ").value;
if(selectedOption=="1"){
..........
}else if(selectedOption=="2"){
........
}else if(selectedOption=="3"){
.......
}else{
document.getElementById(" myCombo ").selectedIndex="0"; //reset combox box with "Select options"
}
}
Comments
Post a Comment