Link to home
Create AccountLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

Html option caption

Hi, Experts, How to change the option caption using javascript? Base on my code, I want to change the option caption from "Yes" to "No". Thanks!

<!DOCTYPE html>
<html>
<body>
<button onclick="return ChangeCaption()">Change</button>
<select name="level" id="iAD8" style="color: black; width:50px;">
    <option value="yes" selected>Yes</option>
    <option value="no">No</option>
</select>

<script>
function ChangeCaption()
{
  document.getElementById("iAD8").value = "No"; 
}
</script>

</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Zakaria Acharki
Zakaria Acharki
Flag of Morocco image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Whing Dela Cruz

ASKER

Perfectly working, thanks a lot sir!
You're welcome, glad to help.