Change the option text : Option Select ComboBox : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » Option Select ComboBox »

 

Change the option text




<html>
<head>
<script type="text/javascript">
function changeText(){
    var x=document.getElementById("aSelectControl")
    x.options[x.selectedIndex].text="Melon"
}
</script>
</head>

<body>
<form>
Select your favorite language:
<select id="aSelectControl">
  <option>Java</option>
  <option>Perl</option>
  <option>PHP</option>
</select>
<br><br>
<input type="button" onclick="changeText()" value="Change text of selected language">
</form>
</body>

</html>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Option Select ComboBox