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>
<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>

function ChangeCaption()
  document.getElementById("iAD8").value = "No"; 


Open in new window

Avatar of Zakaria Acharki
Zakaria Acharki
Flag of Morocco image

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


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