Output

Sample Code

This demo shows how "required" attribute works in "select" tag of Forms.

The required attribute is a boolean attribute. When specified, the user will
be required to select a value before submitting the form.

HTML:

  <form>
    <select name="unittype" required>
      <option value=""> Select unit type </option>
      <option value="v1">v1</option>
    </select>
    <input type="submit"/>
  </form>