Core HTML

Form - Optgroup

This form example demonstrates how to code a form with an optgroup tag in it.

OptgroupForm.html

<!DOCTYPE html>
<html>
  <head>
    <title>XoaX.net's HTML: Form - Optgroup Tag Example</title>
  </head>
  <body>
    <form>
      <select>
        <optgroup label="Old Testament">
          <option value="genesis">Genesis</option>
          <option value="exodus">Exodus</option>
        </optgroup>
        <optgroup label="New Testament">
          <option value="romans">Romans</option>
          <option value="revelation">Revelation</option>
        </optgroup>
      </select>
    </form>
  </body>
</html>
 

Output

 
 

© 2007–2024 XoaX.net LLC. All rights reserved.