Avatar of Whing Dela Cruz
Whing Dela Cruz
Flag 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

HTMLJavaScript

Avatar of undefined
Last Comment
Zakaria Acharki

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Zakaria Acharki

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Whing Dela Cruz

ASKER
Perfectly working, thanks a lot sir!
Zakaria Acharki

You're welcome, glad to help.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy