HTML option value Attribute

The HTML option value attribute define the value of the option HTML element which is to be sent on a server when the form is submitted in an HTML document.


Following is the syntax −

<option value=”text”></option>

Let us see an example of HTML option value Attribute −


Live Demo

<!DOCTYPE html>
   body {
      color: #000;
      height: 100vh;
      background-color: #8BC6EC;
      background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
      text-align: center;
   .btn {
      background: #db133a;
      border: none;
      height: 2rem;
      border-radius: 2px;
      width: 40%;
      display: block;
      color: #fff;
      outline: none;
      cursor: pointer;
      margin: 1rem auto;
<h1>HTML optimum Attribute Demo</h1>
<p>Select your favourite subject:</p>
<form method="post" action="">
<option value="Physics">Physics</option>
<option value="Chemistry">Chemistry</option>
<option value="Biology">Biology</option>
<input type="submit" value="Submit" class="btn">