Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

optgroup

The <optgroup> options group element is used to group <option> elements together.

Code Example

<b>Choose a city:</b> <select name="city"> <optgroup label="East Coast Cities"> <option value="New York">New York</option> <option value="Atlanta">Atlanta</option> <option value="Miami">Miami</option> </optgroup> <optgroup label="West Coast Cities" disabled> <option value="Las Vegas">Las Vegas</option> <option value="Los Angeles">Los Angeles</option> <option value="San Francisco">San Francisco</option> </optgroup> </select> open in code editor

Attributes

globals - the global attributes common to all elements possible values: see global attribute list disabled - specify that the whole group of options be disabled possible values: value not required label - specify the visible label possible values: "string"

Official Documentation

http://www.w3.org/TR/html/forms.html#the-optgroup-element

HTML

Elements

aabbraddressareaasidearticleaudiobbasebdobdiblockquotebodybrbuttoncanvascaptioncitecodecolcolgroupdatadatalistdddeldetailsdfndialogdivdldtemembedfieldsetfigcaptionfigurefooterformh1 h2 h3 h4 h5 h6headheaderhrhtmliiframeimginputinskbdkeygenlabellegendlilinkmainmapmarkmetameternavnoscriptobjectoloptgroupoptionoutputpparampreprogressqrb rp rt rtc rubyssampscriptsectionselectsmallsourcespanstrongstylesub supsummarytabletbodytdtemplatetextareatfootththeadtimetitletrtrackuulvarvideowbr