optgroup in HTML5

Today i found this optgroup tag in HTML5 i think this is very useful to show data as a child parent format in dropdown. Earlier we use some third party plugin for our application. But this is great and i found this tag is very useful.

<select name="cars" id="cars">
      <optgroup label="Swedish Cars">
        <option value="volvo">Volvo</option>
        <option value="saab">Saab</option>
      </optgroup>
      <optgroup label="German Cars">
        <option value="mercedes">Mercedes</option>
        <option value="audi">Audi</option>
      </optgroup>
    </select>

Demo

44 thoughts on “optgroup in HTML5

Leave a Reply

Your email address will not be published. Required fields are marked *