Annotation of html5/spec-author-view/the-button-element.html, revision 1.207
1.187 mike 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><!-- when publishing, change bits marked ZZZ --><html class="split chapter" lang="en-US-x-Hixie"><meta content="text/html; charset=ascii" http-equiv="Content-Type"><title>4.10.8 The button element — HTML5 (Edition for Web Authors)</title><link href="whatwg.css" rel="stylesheet"><style type="text/css">
1.1 mike 2: pre { margin-left: 2em; white-space: pre-wrap; }
3: h2 { margin: 3em 0 1em 0; }
4: h3 { margin: 2.5em 0 1em 0; }
5: h4 { margin: 2.5em 0 0.75em 0; }
6: h5, h6 { margin: 2.5em 0 1em; }
7: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
8: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
9: p { margin: 1em 0; }
10: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
11: dl, dd { margin-top: 0; margin-bottom: 0; }
12: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
13: dt + dt { margin-top: 0; }
14: dd dt { margin-top: 0.25em; margin-bottom: 0; }
15: dd p { margin-top: 0; }
16: dd dl + p { margin-top: 1em; }
17: dd table + p { margin-top: 1em; }
18: p + * > li, dd li { margin: 1em 0; }
19: dt, dfn { font-weight: bold; font-style: normal; }
20: dt dfn { font-style: italic; }
21: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
22: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
23: pre em { font-weight: bolder; font-style: normal; }
24: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
25: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
26: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
1.34 mike 27: table thead, table tbody { border-bottom: solid; }
1.1 mike 28: table tbody th:first-child { border-left: solid; }
29: table tbody th { text-align: left; }
30: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
31: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
32:
33: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
34: .matrix, .matrix td { border: none; text-align: right; }
35: .matrix { margin-left: 2em; }
36: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
37: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
38: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
39:
40: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
41: img.extra { float: right; }
42: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
43: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
44: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
45: pre.css:first-line { color: #AAAA50; }
1.23 mike 46: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
1.1 mike 47: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
48: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
49: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
50: dl.domintro dd p { margin: 0.5em 0; }
51: dl.switch { padding-left: 2em; }
52: dl.switch > dt { text-indent: -1.5em; }
53: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
54: dl.triple { padding: 0 0 0 1em; }
55: dl.triple dt, dl.triple dd { margin: 0; display: inline }
56: dl.triple dt:after { content: ':'; }
57: dl.triple dd:after { content: '\A'; white-space: pre; }
58: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
59: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
60: a .diff-new { border-bottom: 1px blue solid; }
61:
62: h2 { page-break-before: always; }
63: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
64: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
65:
66: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
67:
68: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
69: div.head p { margin: 0; }
70: div.head h1 { margin: 0; }
71: div.head .logo { float: right; margin: 0 1em; }
72: div.head .logo img { border: none } /* remove border from top image */
73: div.head dl { margin: 1em 0; }
74: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
75:
76: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
77: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
78: body > .toc > li > * { margin-bottom: 0.5em; }
79: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
80: .toc, .toc li { list-style: none; }
81:
82: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
83: .brief li { margin: 0; padding: 0; }
84: .brief li p { margin: 0; padding: 0; }
85:
86: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
87: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
88: .category-list li { display: inline; }
89: .category-list li:not(:last-child)::after { content: ', '; }
90: .category-list li > span, .category-list li > a { text-transform: lowercase; }
91: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
92:
93: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
94: .XXX > :first-child { margin-top: 0; }
95: p .XXX { line-height: 3em; }
96: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
97: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
98: .annotation :link, .annotation :visited { color: inherit; }
99: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
100: .annotation span { border: none ! important; }
101: .note { color: green; background: transparent; font-family: sans-serif; }
102: .warning { color: red; background: transparent; }
103: .note, .warning { font-weight: bolder; font-style: italic; }
104: p.note, div.note { padding: 0.5em 2em; }
105: span.note { padding: 0 2em; }
106: .note p:first-child, .warning p:first-child { margin-top: 0; }
107: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
108: .warning:before { font-style: normal; }
109: p.note:before { content: 'Note: '; }
110: p.warning:before { content: '\26A0 Warning! '; }
111:
112: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
113: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
114: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
1.132 mike 115: .bookkeeping dt { margin: 0.5em 2em 0; }
116: .bookkeeping dd { margin: 0 3em 0.5em; }
1.1 mike 117:
118: h4 { position: relative; z-index: 3; }
119: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
120: .element {
121: background: #EEEEFF;
122: color: black;
123: margin: 0 0 1em 0.15em;
124: padding: 0 1em 0.25em 0.75em;
125: border-left: solid #9999FF 0.25em;
126: position: relative;
127: z-index: 1;
128: }
129: .element:before {
130: position: absolute;
131: z-index: 2;
132: top: 0;
133: left: -1.15em;
134: height: 2em;
135: width: 0.9em;
136: background: #EEEEFF;
137: content: ' ';
138: border-style: none none solid solid;
139: border-color: #9999FF;
140: border-width: 0.25em;
141: }
142:
143: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
144: td > .example:only-child { margin: 0 0 0 0.1em; }
145:
146: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
147: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
148: ul.domTree li li { list-style: none; }
149: ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
150: ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
151: ul.domTree span { font-style: italic; font-family: serif; }
152: ul.domTree .t1 code { color: purple; font-weight: bold; }
153: ul.domTree .t2 { font-style: normal; font-family: monospace; }
154: ul.domTree .t2 .name { color: black; font-weight: bold; }
155: ul.domTree .t2 .value { color: blue; font-weight: normal; }
156: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
157: ul.domTree .t7 code, .domTree .t8 code { color: green; }
158: ul.domTree .t10 code { color: teal; }
159:
1.14 mike 160: body.dfnEnabled dfn { cursor: pointer; }
161: .dfnPanel {
162: display: inline;
163: position: absolute;
164: z-index: 10;
165: height: auto;
166: width: auto;
167: padding: 0.5em 0.75em;
168: font: small sans-serif, Droid Sans Fallback;
169: background: #DDDDDD;
170: color: black;
171: border: outset 0.2em;
172: }
173: .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
174: .dfnPanel :link, .dfnPanel :visited { color: black; }
175: .dfnPanel p { font-weight: bolder; }
176: .dfnPanel * + p { margin-top: 0.25em; }
177: .dfnPanel li { list-style-position: inside; }
178:
1.1 mike 179: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
180: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
181: #configUI p label { display: block; }
182: #configUI #updateUI, #configUI .loginUI { text-align: center; }
183: #configUI input[type=button] { display: block; margin: auto; }
1.121 mike 184:
1.1 mike 185: </style><style type="text/css">
186:
187: .applies thead th > * { display: block; }
188: .applies thead code { display: block; }
189: .applies tbody th { whitespace: nowrap; }
190: .applies td { text-align: center; }
191: .applies .yes { background: yellow; }
192:
1.136 mike 193: .matrix, .matrix td { border: hidden; text-align: right; }
1.1 mike 194: .matrix { margin-left: 2em; }
195:
196: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
197: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
198: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
199:
200: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
201: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
202: #table-example-1 caption { padding-bottom: 0.5em; }
203: #table-example-1 thead, #table-example-1 tbody { border: none; }
204: #table-example-1 th, #table-example-1 td { border: solid thin; }
205: #table-example-1 th { font-weight: normal; }
206: #table-example-1 td { border-style: none solid; vertical-align: top; }
207: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
208: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
209: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
210: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
211: #table-example-1 tbody td:first-child::after { content: leader(". "); }
212: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
213: #table-example-1 tbody td:first-child + td { width: 10em; }
214: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
215: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
216:
217: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
218: .apple-table-examples * { font-family: "Times", serif; }
219: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
220: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
221: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
222: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
223: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
224: .apple-table-examples td { text-align: right; vertical-align: top; }
225: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
1.9 mike 226: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
227: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
228: .apple-table-examples sup { line-height: 0; }
229:
1.11 mike 230: .details-example img { vertical-align: top; }
231:
1.26 mike 232: #named-character-references-table {
233: font-size: 0.6em;
234: column-width: 28em;
235: column-gap: 1em;
236: -moz-column-width: 28em;
237: -moz-column-gap: 1em;
238: -webkit-column-width: 28em;
239: -webkit-column-gap: 1em;
240: }
241: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
242: #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
243:
1.35 mike 244: .glyph.control { color: red; }
245:
1.38 mike 246: @font-face {
247: font-family: 'Essays1743';
248: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
249: }
250: @font-face {
251: font-family: 'Essays1743';
252: font-weight: bold;
253: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
254: }
255: @font-face {
256: font-family: 'Essays1743';
257: font-style: italic;
258: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
259: }
260: @font-face {
261: font-family: 'Essays1743';
262: font-style: italic;
263: font-weight: bold;
264: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
265: }
266:
1.25 mike 267: </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script type="text/javascript">
1.157 mike 268: function getCookie(name) {
269: var params = location.search.substr(1).split("&");
270: for (var index = 0; index < params.length; index++) {
271: if (params[index] == name)
272: return "1";
273: var data = params[index].split("=");
274: if (data[0] == name)
275: return unescape(data[1]);
1.9 mike 276: }
1.157 mike 277: var cookies = document.cookie.split("; ");
278: for (var index = 0; index < cookies.length; index++) {
279: var data = cookies[index].split("=");
280: if (data[0] == name)
281: return unescape(data[1]);
1.9 mike 282: }
1.157 mike 283: return null;
284: }
285: function load(script) {
286: var e = document.createElement('script');
287: e.setAttribute('src', script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
288: document.body.appendChild(e);
289: }
290: function init() {
291: if (location.search == '?slow-browser')
292: return;
293: var configUI = document.createElement('div');
294: configUI.id = 'configUI';
295: document.body.appendChild(configUI);
296: if (document.getElementById('head'))
297: load('toc.js');
298: load('dfn.js');
299: if (getCookie('profile') == '1')
300: document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
301: fixBrokenLink();
302: }
1.160 mike 303: </script><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><link href="style.css" rel="stylesheet"><script src="link-fixup.js"></script><link href="common-input-element-attributes.html" rel="prev" title="4.10.7.2 Common input element attributes">
304: <link href="Overview.html#contents" rel="index" title="Table of contents">
305: <link href="association-of-controls-and-forms.html" rel="next" title="4.10.18 Association of controls and forms">
306: <body onload="fixBrokenLink(); init()"><div class="head" id="head">
1.9 mike 307: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.36 mike 308:
1.207 ! mike 309: <h1>HTML5 (Edition for Web Authors)<span class="rcsrevision"> revision 1.4360</span></h1>
1.9 mike 310: </div><div>
1.160 mike 311: <a href="common-input-element-attributes.html">← 4.10.7.2 Common input element attributes</a> –
312: <a href="Overview.html#contents">Table of contents</a> –
313: <a href="association-of-controls-and-forms.html">4.10.18 Association of controls and forms →</a>
314: <ol class="toc"><li><ol><li><ol><li><a href="the-button-element.html#the-button-element" id="x4.10.8-the-button-element"><span class="secno">4.10.8 </span>The <code>button</code> element</a><li><a href="the-button-element.html#the-select-element" id="x4.10.9-the-select-element"><span class="secno">4.10.9 </span>The <code>select</code> element</a><li><a href="the-button-element.html#the-datalist-element" id="x4.10.10-the-datalist-element"><span class="secno">4.10.10 </span>The <code>datalist</code> element</a><li><a href="the-button-element.html#the-optgroup-element" id="x4.10.11-the-optgroup-element"><span class="secno">4.10.11 </span>The <code>optgroup</code> element</a><li><a href="the-button-element.html#the-option-element" id="x4.10.12-the-option-element"><span class="secno">4.10.12 </span>The <code>option</code> element</a><li><a href="the-button-element.html#the-textarea-element" id="x4.10.13-the-textarea-element"><span class="secno">4.10.13 </span>The <code>textarea</code> element</a><li><a href="the-button-element.html#the-keygen-element" id="x4.10.14-the-keygen-element"><span class="secno">4.10.14 </span>The <code>keygen</code> element</a><li><a href="the-button-element.html#the-output-element" id="x4.10.15-the-output-element"><span class="secno">4.10.15 </span>The <code>output</code> element</a><li><a href="the-button-element.html#the-progress-element" id="x4.10.16-the-progress-element"><span class="secno">4.10.16 </span>The <code>progress</code> element</a><li><a href="the-button-element.html#the-meter-element" id="x4.10.17-the-meter-element"><span class="secno">4.10.17 </span>The <code>meter</code> element</a></ol></ol></ol></div>
1.156 mike 315:
1.202 mike 316: <h4 id="the-button-element"><span class="secno">4.10.8 </span>The <dfn><code>button</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.203 mike 317: <dd><a href="content-models.html#flow-content" id="flow-content-122">Flow content</a>.</dd>
318: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-127">Phrasing content</a>.</dd>
1.156 mike 319: <dd><a href="content-models.html#interactive-content" id="interactive-content-14">Interactive content</a>.</dd>
1.202 mike 320: <dd><a href="forms.html#category-listed" id="category-listed-5" title="category-listed">Listed</a>, <a href="forms.html#category-label" id="category-label-3" title="category-label">labelable</a>, and <a href="forms.html#category-submit" id="category-submit-4" title="category-submit">submittable</a> <a href="forms.html#form-associated-element" id="form-associated-element-9">form-associated element</a>.</dd>
1.203 mike 321: <dt>Contexts in which this element can be used:</dt>
322: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-128">phrasing content</a> is expected.</dd>
1.9 mike 323: <dt>Content model:</dt>
1.203 mike 324: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-129">Phrasing content</a>, but there must be no <a href="content-models.html#interactive-content" id="interactive-content-15">interactive content</a> descendant.</dd>
1.9 mike 325: <dt>Content attributes:</dt>
1.156 mike 326: <dd><a href="elements.html#global-attributes" id="global-attributes-85">Global attributes</a></dd>
327: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-1">autofocus</a></code></dd>
328: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-12">disabled</a></code></dd>
1.190 mike 329: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-50">form</a></code></dd>
1.156 mike 330: <dd><code title="attr-fs-formaction"><a href="association-of-controls-and-forms.html#attr-fs-formaction" id="formaction-26">formaction</a></code></dd>
331: <dd><code title="attr-fs-formenctype"><a href="association-of-controls-and-forms.html#attr-fs-formenctype" id="formenctype-26">formenctype</a></code></dd>
332: <dd><code title="attr-fs-formmethod"><a href="association-of-controls-and-forms.html#attr-fs-formmethod" id="formmethod-26">formmethod</a></code></dd>
333: <dd><code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate" id="formnovalidate-27">formnovalidate</a></code></dd>
334: <dd><code title="attr-fs-formtarget"><a href="association-of-controls-and-forms.html#attr-fs-formtarget" id="formtarget-26">formtarget</a></code></dd>
335: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-37">name</a></code></dd>
1.202 mike 336: <dd><code title="attr-button-type"><a href="#attr-button-type" id="type-74">type</a></code></dd>
1.156 mike 337: <dd><code title="attr-button-value"><a href="#attr-button-value" id="value-29">value</a></code></dd>
1.9 mike 338: <dt>DOM interface:</dt>
339: <dd>
1.156 mike 340: <pre class="idl">interface <dfn id="htmlbuttonelement">HTMLButtonElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-93">HTMLElement</a> {
1.162 mike 341: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.'>autofocus</a>;
342: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.'>disabled</a>;
343: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-5">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
344: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formaction" title='Read about this "formAction" reference in the full HTML5 spec.'>formAction</a>;
345: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formenctype" title='Read about this "formEnctype" reference in the full HTML5 spec.'>formEnctype</a>;
346: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formmethod" title='Read about this "formMethod" reference in the full HTML5 spec.'>formMethod</a>;
347: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formnovalidate" title='Read about this "formNoValidate" reference in the full HTML5 spec.'>formNoValidate</a>;
348: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formtarget" title='Read about this "formTarget" reference in the full HTML5 spec.'>formTarget</a>;
349: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.'>name</a>;
350: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-button-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a>;
351: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-button-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
352:
353: readonly attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.'>willValidate</a>;
354: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.'>validity</a>;
355: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.'>validationMessage</a>;
356: boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.'>checkValidity</a>();
357: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.'>setCustomValidity</a>(in DOMString error);
1.9 mike 358:
1.162 mike 359: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
1.9 mike 360: };</pre>
361: </dd>
1.162 mike 362: </dl><p>The <code><a href="#the-button-element" id="button-11">button</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.160 mike 363: button. <p>The element is a <a href="forms.html#concept-button" id="concept-button-4" title="concept-button">button</a>.<p>The <dfn id="attr-button-type" title="attr-button-type"><code>type</code></dfn>
1.9 mike 364: attribute controls the behavior of the button when it is activated.
1.156 mike 365: It is an <a href="common-microsyntaxes.html#enumerated-attribute" id="enumerated-attribute-8">enumerated attribute</a>. The following table
1.160 mike 366: lists the keywords and states for the attribute — the keywords
1.9 mike 367: in the left column map to the states in the cell in the second
1.160 mike 368: column on the same row as the keyword.<table><thead><tr><th> Keyword
369: <th> State
370: <th> Brief description
371: <tbody><tr><td><dfn id="attr-button-type-submit" title="attr-button-type-submit"><code>submit</code></dfn>
1.162 mike 372: <td><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.'>Submit Button</a>
1.160 mike 373: <td>Submits the form.
374: <tr><td><dfn id="attr-button-type-reset" title="attr-button-type-reset"><code>reset</code></dfn>
1.162 mike 375: <td><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-reset-state" title='Read about this "Reset Button" reference in the full HTML5 spec.'>Reset Button</a>
1.160 mike 376: <td>Resets the form.
377: <tr><td><dfn id="attr-button-type-button" title="attr-button-type-button"><code>button</code></dfn>
1.162 mike 378: <td><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-button-state" title='Read about this "Button" reference in the full HTML5 spec.'>Button</a>
1.160 mike 379: <td>Does nothing.
1.162 mike 380: </table><p>The <i>missing value default</i> is the <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.'>Submit Button</a>
1.202 mike 381: state.<p>If the <code title="attr-button-type"><a href="#attr-button-type" id="type-75">type</a></code> attribute is in
1.162 mike 382: the <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.'>Submit Button</a>
1.190 mike 383: state, the element is specifically a <a href="forms.html#concept-submit-button" id="concept-submit-button-2" title="concept-submit-button">submit button</a>.<p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-51">form</a></code> attribute is used to
1.156 mike 384: explicitly associate the <code><a href="#the-button-element" id="button-12">button</a></code> element with its
385: <a href="association-of-controls-and-forms.html#form-owner" id="form-owner-8">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-38">name</a></code>
386: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-13">disabled</a></code> attribute is used to make
1.9 mike 387: the control non-interactive and to prevent its value from being
1.156 mike 388: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-2">autofocus</a></code>
389: attribute controls focus. The <code title="attr-fs-formaction"><a href="association-of-controls-and-forms.html#attr-fs-formaction" id="formaction-27">formaction</a></code>, <code title="attr-fs-formenctype"><a href="association-of-controls-and-forms.html#attr-fs-formenctype" id="formenctype-27">formenctype</a></code>, <code title="attr-fs-formmethod"><a href="association-of-controls-and-forms.html#attr-fs-formmethod" id="formmethod-27">formmethod</a></code>, <code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate" id="formnovalidate-28">formnovalidate</a></code>, and <code title="attr-fs-formtarget"><a href="association-of-controls-and-forms.html#attr-fs-formtarget" id="formtarget-27">formtarget</a></code> attributes are
1.160 mike 390: <a href="association-of-controls-and-forms.html#attributes-for-form-submission" id="attributes-for-form-submission-3">attributes for form submission</a>.<p class="note">The <code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate" id="formnovalidate-29">formnovalidate</a></code> attribute can
1.9 mike 391: be used to make submit buttons that do not trigger the constraint
1.160 mike 392: validation.<p>The <code title="attr-fs-formaction"><a href="association-of-controls-and-forms.html#attr-fs-formaction" id="formaction-28">formaction</a></code>, <code title="attr-fs-formenctype"><a href="association-of-controls-and-forms.html#attr-fs-formenctype" id="formenctype-28">formenctype</a></code>, <code title="attr-fs-formmethod"><a href="association-of-controls-and-forms.html#attr-fs-formmethod" id="formmethod-28">formmethod</a></code>, <code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate" id="formnovalidate-30">formnovalidate</a></code>, and <code title="attr-fs-formtarget"><a href="association-of-controls-and-forms.html#attr-fs-formtarget" id="formtarget-28">formtarget</a></code> must not be specified
1.202 mike 393: if the element's <code title="attr-button-type"><a href="#attr-button-type" id="type-76">type</a></code>
1.162 mike 394: attribute is not in the <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.'>Submit Button</a>
1.160 mike 395: state.<p>The <dfn id="attr-button-value" title="attr-button-value"><code>value</code></dfn>
1.9 mike 396: attribute gives the element's value for the purposes of form
1.162 mike 397: submission. The element's <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#concept-fe-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a> is the value of the element's
1.156 mike 398: <code title="attr-button-value"><a href="#attr-button-value" id="value-30">value</a></code> attribute, if there is
1.160 mike 399: one, or the empty string otherwise.<p class="note">A button (and its value) is only included in the
1.9 mike 400: form submission if the button itself was used to initiate the form
1.160 mike 401: submission.<div class="example">
1.9 mike 402:
403: <p>The following button is labeled "Show hint" and pops up a dialog
404: box when activated:</p>
405:
406: <pre><button type=button
407: onclick="alert('This 15-20 minute piece was composed by George Gershwin.')">
408: Show hint
409: </button></pre>
410:
1.202 mike 411: </div><h4 id="the-select-element"><span class="secno">4.10.9 </span>The <dfn><code>select</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.203 mike 412: <dd><a href="content-models.html#flow-content" id="flow-content-123">Flow content</a>.</dd>
413: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-130">Phrasing content</a>.</dd>
1.156 mike 414: <dd><a href="content-models.html#interactive-content" id="interactive-content-16">Interactive content</a>.</dd>
1.202 mike 415: <dd><a href="forms.html#category-listed" id="category-listed-6" title="category-listed">Listed</a>, <a href="forms.html#category-label" id="category-label-4" title="category-label">labelable</a>, <a href="forms.html#category-submit" id="category-submit-5" title="category-submit">submittable</a>, and <a href="forms.html#category-reset" id="category-reset-2" title="category-reset">resettable</a> <a href="forms.html#form-associated-element" id="form-associated-element-10">form-associated element</a>.</dd>
1.203 mike 416: <dt>Contexts in which this element can be used:</dt>
417: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-131">phrasing content</a> is expected.</dd>
1.9 mike 418: <dt>Content model:</dt>
1.191 mike 419: <dd>Zero or more <code><a href="#the-option-element" id="option-9">option</a></code> or <code><a href="#the-optgroup-element" id="optgroup-3">optgroup</a></code> elements.</dd>
1.9 mike 420: <dt>Content attributes:</dt>
1.156 mike 421: <dd><a href="elements.html#global-attributes" id="global-attributes-86">Global attributes</a></dd>
422: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-3">autofocus</a></code></dd>
423: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-14">disabled</a></code></dd>
1.190 mike 424: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-52">form</a></code></dd>
1.156 mike 425: <dd><code title="attr-select-multiple"><a href="#attr-select-multiple" id="multiple-29">multiple</a></code></dd>
426: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-39">name</a></code></dd>
427: <dd><code title="attr-select-required"><a href="#attr-select-required" id="required-27">required</a></code></dd>
428: <dd><code title="attr-select-size"><a href="#attr-select-size" id="size-30">size</a></code></dd>
1.9 mike 429: <dt>DOM interface:</dt>
430: <dd>
1.156 mike 431: <pre class="idl">interface <dfn id="htmlselectelement">HTMLSelectElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-94">HTMLElement</a> {
1.162 mike 432: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.'>autofocus</a>;
433: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.'>disabled</a>;
434: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-6">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
435: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-multiple" title='Read about this "multiple" reference in the full HTML5 spec.'>multiple</a>;
436: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.'>name</a>;
1.165 mike 437: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-required" title='Read about this "required" reference in the full HTML5 spec.'>required</a>;
1.162 mike 438: attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-size" title='Read about this "size" reference in the full HTML5 spec.'>size</a>;
1.160 mike 439:
1.162 mike 440: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a>;
1.160 mike 441:
1.162 mike 442: readonly attribute <a href="urls.html#htmloptionscollection" id="htmloptionscollection-3">HTMLOptionsCollection</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-options" title='Read about this "options" reference in the full HTML5 spec.'>options</a>;
443: attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-length" title='Read about this "length" reference in the full HTML5 spec.'>length</a>;
444: caller getter any <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-item" title='Read about this "item" reference in the full HTML5 spec.'>item</a>(in unsigned long index);
445: caller getter any <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-nameditem" title='Read about this "namedItem" reference in the full HTML5 spec.'>namedItem</a>(in DOMString name);
446: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-add" title='Read about this "add" reference in the full HTML5 spec.'>add</a>(in <a href="elements.html#htmlelement" id="htmlelement-95">HTMLElement</a> element, in optional <a href="elements.html#htmlelement" id="htmlelement-96">HTMLElement</a> before);
447: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-add" title='Read about this "add" reference in the full HTML5 spec.'>add</a>(in <a href="elements.html#htmlelement" id="htmlelement-97">HTMLElement</a> element, in long before);
448: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-remove" title='Read about this "remove" reference in the full HTML5 spec.'>remove</a>(in long index);
449:
1.202 mike 450: readonly attribute <a href="urls.html#htmlcollection" id="htmlcollection-34">HTMLCollection</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedoptions" title='Read about this "selectedOptions" reference in the full HTML5 spec.'>selectedOptions</a>;
1.162 mike 451: attribute long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedindex" title='Read about this "selectedIndex" reference in the full HTML5 spec.'>selectedIndex</a>;
452: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
453:
454: readonly attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.'>willValidate</a>;
455: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.'>validity</a>;
456: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.'>validationMessage</a>;
457: boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.'>checkValidity</a>();
458: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.'>setCustomValidity</a>(in DOMString error);
1.9 mike 459:
1.162 mike 460: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
1.9 mike 461: };</pre>
462: </dd>
463: </dl><!-- Proposals for v2:
464: * <select value=""> as an alternative to <option selected>
465: http://developers.slashdot.org/comments.pl?sid=426306&cid=22142072
1.11 mike 466: <Philip`> http://www.ipiao.com.cn/ does <select size="1" name="to"><script type="text/javascript">City_Default="PEK"</script><SCRIPT language=javascript
1.9 mike 467: src="/js/flightcity.js"></SCRIPT></select> which is the kind of thing that could be much simpler with <select value="PEK">
1.156 mike 468: --><p>The <code><a href="#the-select-element" id="select-17">select</a></code> element represents a control for
1.160 mike 469: selecting amongst a set of options.<p>The <dfn id="attr-select-multiple" title="attr-select-multiple"><code>multiple</code></dfn>
1.156 mike 470: attribute is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-13">boolean attribute</a>. If the attribute is
471: present, then the <code><a href="#the-select-element" id="select-18">select</a></code> element
1.162 mike 472: <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a control for selecting zero or more options
1.156 mike 473: from the <a href="#concept-select-option-list" id="concept-select-option-list-1" title="concept-select-option-list">list of
1.9 mike 474: options</a>. If the attribute is absent, then the
1.162 mike 475: <code><a href="#the-select-element" id="select-19">select</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a control for
1.160 mike 476: selecting a single option from the <a href="#concept-select-option-list" id="concept-select-option-list-2" title="concept-select-option-list">list of options</a>.<p>The <dfn id="attr-select-size" title="attr-select-size"><code>size</code></dfn>
1.156 mike 477: attribute gives the number of options to show to the user. The <code title="attr-input-size"><a href="common-input-element-attributes.html#attr-input-size" id="size-26">size</a></code> attribute, if specified, must
478: have a value that is a <a href="common-microsyntaxes.html#valid-non-negative-integer" id="valid-non-negative-integer-10">valid non-negative integer</a>
479: greater than zero. If the <code title="attr-select-multiple"><a href="#attr-select-multiple" id="multiple-30">multiple</a></code> attribute is present,
480: then the <code title="attr-input-size"><a href="common-input-element-attributes.html#attr-input-size" id="size-27">size</a></code> attribute's
481: default value is 4. If the <code title="attr-select-multiple"><a href="#attr-select-multiple" id="multiple-31">multiple</a></code> attribute is absent,
482: then the <code title="attr-input-size"><a href="common-input-element-attributes.html#attr-input-size" id="size-28">size</a></code> attribute's
1.160 mike 483: default value is 1.<p>The <dfn id="concept-select-option-list" title="concept-select-option-list">list of options</dfn>
1.156 mike 484: for a <code><a href="#the-select-element" id="select-20">select</a></code> element consists of all the
1.191 mike 485: <code><a href="#the-option-element" id="option-10">option</a></code> element children of the <code><a href="#the-select-element" id="select-21">select</a></code>
486: element, and all the <code><a href="#the-option-element" id="option-11">option</a></code> element children of all the
1.190 mike 487: <code><a href="#the-optgroup-element" id="optgroup-4">optgroup</a></code> element children of the <code><a href="#the-select-element" id="select-22">select</a></code>
1.160 mike 488: element, in <a href="infrastructure.html#tree-order" id="tree-order-5">tree order</a>.<p>The <dfn id="attr-select-required" title="attr-select-required"><code>required</code></dfn>
1.156 mike 489: attribute is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-14">boolean attribute</a>. When specified, the
1.138 mike 490: user will be required to select a value before submitting the
1.160 mike 491: form.<p>If a <code><a href="#the-select-element" id="select-23">select</a></code> element has a <code title="attr-select-required"><a href="#attr-select-required" id="required-28">required</a></code> attribute specified,
1.156 mike 492: does not have a <code title="attr-select-multiple"><a href="#attr-select-multiple" id="multiple-32">multiple</a></code>
1.162 mike 493: attribute specified, and has a <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#concept-select-size" title='Read about this "display size" reference in the full HTML5 spec.'>display size</a> of 1; and if the
1.156 mike 494: <a href="#concept-option-value" id="concept-option-value-0" title="concept-option-value">value</a> of the first
1.191 mike 495: <code><a href="#the-option-element" id="option-12">option</a></code> element in the <code><a href="#the-select-element" id="select-24">select</a></code> element's
1.156 mike 496: <a href="#concept-select-option-list" id="concept-select-option-list-3" title="concept-select-option-list">list of options</a> (if
1.191 mike 497: any) is the empty string, and that <code><a href="#the-option-element" id="option-13">option</a></code> is not <a href="#concept-option-disabled" id="concept-option-disabled-0" title="concept-option-disabled">disabled</a>, and, finally, that
498: <code><a href="#the-option-element" id="option-14">option</a></code> element's parent node is the <code><a href="#the-select-element" id="select-25">select</a></code>
1.190 mike 499: element (and not an <code><a href="#the-optgroup-element" id="optgroup-5">optgroup</a></code> element), then that
1.191 mike 500: <code><a href="#the-option-element" id="option-15">option</a></code> is the <code><a href="#the-select-element" id="select-26">select</a></code> element's
1.190 mike 501: <dfn id="placeholder-label-option">placeholder label option</dfn>.<p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-53">form</a></code> attribute is used to
1.156 mike 502: explicitly associate the <code><a href="#the-select-element" id="select-27">select</a></code> element with its
503: <a href="association-of-controls-and-forms.html#form-owner" id="form-owner-9">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-40">name</a></code>
504: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-15">disabled</a></code> attribute is used to make
1.9 mike 505: the control non-interactive and to prevent its value from being
1.156 mike 506: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-4">autofocus</a></code>
1.162 mike 507: attribute controls focus.<dl class="domintro"><dt><var title="">select</var> . <code title="dom-select-type"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a></code></dt>
1.9 mike 508:
509: <dd>
510:
511: <p>Returns "<code title="">select-multiple</code>" if the element
1.156 mike 512: has a <code title="attr-select-multiple"><a href="#attr-select-multiple" id="multiple-33">multiple</a></code>
1.9 mike 513: attribute, and "<code title="">select-one</code>"
514: otherwise.</p>
515:
516: </dd>
517:
1.162 mike 518: <dt><var title="">select</var> . <code title="dom-select-options"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-options" title='Read about this "options" reference in the full HTML5 spec.'>options</a></code></dt>
1.9 mike 519:
520: <dd>
521:
1.156 mike 522: <p>Returns an <code><a href="urls.html#htmloptionscollection" id="htmloptionscollection-4">HTMLOptionsCollection</a></code> of the <a href="#concept-select-option-list" id="concept-select-option-list-4" title="concept-select-option-list">list of options</a>.</p>
1.9 mike 523:
524: </dd>
525:
1.162 mike 526: <dt><var title="">select</var> . <code title="dom-select-length"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-length" title='Read about this "length" reference in the full HTML5 spec.'>length</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 527: <dd>
1.156 mike 528: <p>Returns the number of elements in the <a href="#concept-select-option-list" id="concept-select-option-list-5" title="concept-select-option-list">list of options</a>.</p>
1.191 mike 529: <p>When set to a smaller number, truncates the number of <code><a href="#the-option-element" id="option-16">option</a></code> elements in the <code><a href="#the-select-element" id="select-28">select</a></code>.</p>
530: <p>When set to a greater number, adds new blank <code><a href="#the-option-element" id="option-17">option</a></code> elements to the <code><a href="#the-select-element" id="select-29">select</a></code>.</p>
1.9 mike 531: </dd>
532:
1.162 mike 533: <dt><var title="">element</var> = <var title="">select</var> . <code title="dom-select-item"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-item" title='Read about this "item" reference in the full HTML5 spec.'>item</a></code>(<var title="">index</var>)</dt>
1.9 mike 534: <dt><var title="">select</var>[<var title="">index</var>]</dt>
535: <dt><var title="">select</var>(<var title="">index</var>)</dt>
536: <dd>
1.156 mike 537: <p>Returns the item with index <var title="">index</var> from the <a href="#concept-select-option-list" id="concept-select-option-list-6" title="concept-select-option-list">list of options</a>. The items are sorted in <a href="infrastructure.html#tree-order" id="tree-order-6">tree order</a>.</p>
1.9 mike 538: <p>Returns null if <var title="">index</var> is out of range.</p>
539: </dd>
540:
1.162 mike 541: <dt><var title="">element</var> = <var title="">select</var> . <code title="dom-select-item"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-item" title='Read about this "namedItem" reference in the full HTML5 spec.'>namedItem</a></code>(<var title="">name</var>)</dt>
1.9 mike 542: <dt><var title="">select</var>[<var title="">name</var>]</dt>
543: <dt><var title="">select</var>(<var title="">name</var>)</dt>
544: <dd>
1.201 mike 545: <p>Returns the item with <a href="elements.html#concept-id" id="concept-id-17" title="concept-id">ID</a> or <code title="attr-option-name"><a href="obsolete.html#attr-option-name" id="name-59">name</a></code> <var title="">name</var> from the <a href="#concept-select-option-list" id="concept-select-option-list-7" title="concept-select-option-list">list of options</a>.</p>
1.162 mike 546: <p>If there are multiple matching items, then a <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a></code> object containing all those elements is returned.</p>
1.201 mike 547: <p>Returns null if no element with that <a href="elements.html#concept-id" id="concept-id-18" title="concept-id">ID</a> could be found.</p>
1.9 mike 548: </dd>
549:
1.162 mike 550: <dt><var title="">select</var> . <code title="dom-select-add"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-add" title='Read about this "add" reference in the full HTML5 spec.'>add</a></code>(<var title="">element</var> [, <var title="">before</var> ])</dt>
1.9 mike 551: <dd>
552: <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
553: <p>The <var title="">before</var> argument can be a number, in
554: which case <var title="">element</var> is inserted before the item
1.156 mike 555: with that number, or an element from the <a href="#concept-select-option-list" id="concept-select-option-list-8" title="concept-select-option-list">list of options</a>, in
1.9 mike 556: which case <var title="">element</var> is inserted before that
557: element.</p>
558: <p>If <var title="">before</var> is omitted, null, or a number out
559: of range, then <var title="">element</var> will be added at the
560: end of the list.</p>
1.156 mike 561: <p>This method will throw a <code><a href="urls.html#hierarchy_request_err" id="hierarchy_request_err-5">HIERARCHY_REQUEST_ERR</a></code>
1.9 mike 562: exception if <var title="">element</var> is an ancestor of the
1.191 mike 563: element into which it is to be inserted. If <var title="">element</var> is not an <code><a href="#the-option-element" id="option-18">option</a></code> or
1.190 mike 564: <code><a href="#the-optgroup-element" id="optgroup-6">optgroup</a></code> element, then the method does nothing.</p>
1.9 mike 565: </dd>
566:
1.162 mike 567: <dt><var title="">select</var> . <code title="dom-select-selectedOptions"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedoptions" title='Read about this "selectedOptions" reference in the full HTML5 spec.'>selectedOptions</a></code></dt>
1.9 mike 568:
569: <dd>
570:
1.202 mike 571: <p>Returns an <code><a href="urls.html#htmlcollection" id="htmlcollection-35">HTMLCollection</a></code> of the <a href="#concept-select-option-list" id="concept-select-option-list-9" title="concept-select-option-list">list of options</a> that are
1.9 mike 572: selected.</p>
573:
574: </dd>
575:
1.162 mike 576: <dt><var title="">select</var> . <code title="dom-select-selectedIndex"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedindex" title='Read about this "selectedIndex" reference in the full HTML5 spec.'>selectedIndex</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 577:
578: <dd>
579:
580: <p>Returns the index of the first selected item, if any, or
1.160 mike 581: −1 if there is no selected item.</p>
1.9 mike 582:
583: <p>Can be set, to change the selection.</p>
584:
585: </dd>
586:
1.162 mike 587: <dt><var title="">select</var> . <code title="dom-select-value"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 588:
589: <dd>
590:
1.162 mike 591: <p>Returns the <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#concept-fe-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a> of the
1.9 mike 592: first selected item, if any, or the empty string if there is no
593: selected item.</p>
594:
595: <p>Can be set, to change the selection.</p>
596:
597: </dd>
598:
599: </dl><div class="example">
600:
1.156 mike 601: <p>The following example shows how a <code><a href="#the-select-element" id="select-30">select</a></code> element
1.9 mike 602: can be used to offer the user with a set of options from which the
603: user can select a single option. The default option is
604: preselected.</p>
605:
606: <pre><p>
607: <label for="unittype">Select unit type:</label>
608: <select id="unittype" name="unittype">
609: <option value="1"> Miner </option>
610: <option value="2"> Puffer </option>
611: <option value="3" selected> Snipey </option>
612: <option value="4"> Max </option>
613: <option value="5"> Firebot </option>
614: </select>
615: </p></pre>
616:
617: </div><div class="example">
618:
619: <p>Here, the user is offered a set of options from which he can
620: select any number. By default, all five options are selected.</p>
621:
622: <pre><p>
623: <label for="allowedunits">Select unit types to enable on this map:</label>
624: <select id="allowedunits" name="allowedunits" multiple>
625: <option value="1" selected> Miner </option>
626: <option value="2" selected> Puffer </option>
627: <option value="3" selected> Snipey </option>
628: <option value="4" selected> Max </option>
629: <option value="5" selected> Firebot </option>
630: </select>
631: </p></pre>
632:
1.202 mike 633: </div><h4 id="the-datalist-element"><span class="secno">4.10.10 </span>The <dfn><code>datalist</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.203 mike 634: <dd><a href="content-models.html#flow-content" id="flow-content-124">Flow content</a>.</dd>
635: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-132">Phrasing content</a>.</dd>
636: <dt>Contexts in which this element can be used:</dt>
637: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-133">phrasing content</a> is expected.</dd>
1.9 mike 638: <dt>Content model:</dt>
1.203 mike 639: <dd>Either: <a href="content-models.html#phrasing-content" id="phrasing-content-134">phrasing content</a>.</dd>
1.191 mike 640: <dd>Or: Zero or more <code><a href="#the-option-element" id="option-19">option</a></code> elements.</dd>
1.9 mike 641: <dt>Content attributes:</dt>
1.156 mike 642: <dd><a href="elements.html#global-attributes" id="global-attributes-87">Global attributes</a></dd>
1.9 mike 643: <dt>DOM interface:</dt>
644: <dd>
1.156 mike 645: <pre class="idl">interface <dfn id="htmldatalistelement">HTMLDataListElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-98">HTMLElement</a> {
1.202 mike 646: readonly attribute <a href="urls.html#htmlcollection" id="htmlcollection-36">HTMLCollection</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-datalist-options" title='Read about this "options" reference in the full HTML5 spec.'>options</a>;
1.9 mike 647: };</pre>
648: </dd>
1.156 mike 649: </dl><p>The <code><a href="#the-datalist-element" id="datalist-13">datalist</a></code> element represents a set of
1.191 mike 650: <code><a href="#the-option-element" id="option-20">option</a></code> elements that represent predefined options for
1.9 mike 651: other controls. The contents of the element represents fallback
1.191 mike 652: content for legacy user agents, intermixed with <code><a href="#the-option-element" id="option-21">option</a></code>
1.9 mike 653: elements that represent the predefined options. In the rendering,
1.162 mike 654: the <code><a href="#the-datalist-element" id="datalist-14">datalist</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a>
1.160 mike 655: nothing.<p>The <code><a href="#the-datalist-element" id="datalist-15">datalist</a></code> element is hooked up to an
1.202 mike 656: <code><a href="the-input-element.html#the-input-element" id="input-116">input</a></code> element using the <code title="attr-input-list"><a href="common-input-element-attributes.html#attr-input-list" id="list-29">list</a></code> attribute on the
657: <code><a href="the-input-element.html#the-input-element" id="input-117">input</a></code> element. <!-- v2DATAGRID The
1.9 mike 658: <code>datalist</code> element can also be used with a
659: <code>datagrid</code> element, as the source of autocompletion hints
660: for <code title="datagrid-type-editable">editable</code>
1.191 mike 661: cells. --><p>Each <code><a href="#the-option-element" id="option-22">option</a></code> element that is a descendant of the
1.156 mike 662: <code><a href="#the-datalist-element" id="datalist-16">datalist</a></code> element, that is not <a href="#concept-option-disabled" id="concept-option-disabled-1" title="concept-option-disabled">disabled</a>, and whose <a href="#concept-option-value" id="concept-option-value-1" title="concept-option-value">value</a> is a string that isn't the
663: empty string, represents a suggestion. Each suggestion has a <a href="#concept-option-value" id="concept-option-value-2" title="concept-option-value">value</a> and a <a href="#concept-option-label" id="concept-option-label-0" title="concept-option-label">label</a>.
1.9 mike 664:
1.162 mike 665: <dl class="domintro"><dt><var title="">datalist</var> . <code title="dom-datalist-options"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-datalist-options" title='Read about this "options" reference in the full HTML5 spec.'>options</a></code></dt>
1.9 mike 666:
667: <dd>
1.202 mike 668: <p>Returns an <code><a href="urls.html#htmlcollection" id="htmlcollection-37">HTMLCollection</a></code> of the <code>options</code> elements of the table.</p>
1.9 mike 669: </dd>
670:
1.202 mike 671: </dl><h4 id="the-optgroup-element"><span class="secno">4.10.11 </span>The <dfn><code>optgroup</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.9 mike 672: <dd>None.</dd>
1.203 mike 673: <dt>Contexts in which this element can be used:</dt>
1.156 mike 674: <dd>As a child of a <code><a href="#the-select-element" id="select-31">select</a></code> element.</dd>
1.9 mike 675: <dt>Content model:</dt>
1.191 mike 676: <dd>Zero or more <code><a href="#the-option-element" id="option-23">option</a></code> elements.</dd>
1.9 mike 677: <dt>Content attributes:</dt>
1.156 mike 678: <dd><a href="elements.html#global-attributes" id="global-attributes-88">Global attributes</a></dd>
679: <dd><code title="attr-optgroup-disabled"><a href="#attr-optgroup-disabled" id="disabled-3">disabled</a></code></dd>
1.203 mike 680: <dd><code title="attr-optgroup-label"><a href="#attr-optgroup-label" id="label-27">label</a></code></dd>
1.9 mike 681: <dt>DOM interface:</dt>
682: <dd>
1.156 mike 683: <pre class="idl">interface <dfn id="htmloptgroupelement">HTMLOptGroupElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-99">HTMLElement</a> {
1.162 mike 684: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-optgroup-disabled" title='Read about this "disabled" reference in the full HTML5 spec.'>disabled</a>;
685: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-optgroup-label" title='Read about this "label" reference in the full HTML5 spec.'>label</a>;
1.9 mike 686: };</pre>
687: </dd>
1.190 mike 688: </dl><!-- v2: make optgroups selectable if they have a value. --><p>The <code><a href="#the-optgroup-element" id="optgroup-7">optgroup</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a group of
1.191 mike 689: <code><a href="#the-option-element" id="option-24">option</a></code> elements with a common label.<p>The element's group of <code><a href="#the-option-element" id="option-25">option</a></code> elements consists of
690: the <code><a href="#the-option-element" id="option-26">option</a></code> elements that are children of the
1.190 mike 691: <code><a href="#the-optgroup-element" id="optgroup-8">optgroup</a></code> element.<p>The <dfn id="attr-optgroup-disabled" title="attr-optgroup-disabled"><code>disabled</code></dfn> attribute
1.156 mike 692: is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-15">boolean attribute</a> and can be used to <a href="#concept-option-disabled" id="concept-option-disabled-2" title="concept-option-disabled">disable</a> a group of
1.191 mike 693: <code><a href="#the-option-element" id="option-27">option</a></code> elements together.<p>The <dfn id="attr-optgroup-label" title="attr-optgroup-label"><code>label</code></dfn>
1.9 mike 694: attribute must be specified. Its value gives the name of the group,
1.160 mike 695: for the purposes of the user interface. <div class="example">
1.9 mike 696:
697: <p>The following snippet shows how a set of lessons from three
1.156 mike 698: courses could be offered in a <code><a href="#the-select-element" id="select-32">select</a></code> drop-down
1.9 mike 699: widget:</p>
700:
701: <pre><form action="courseselector.dll" method="get">
702: <p>Which course would you like to watch today?
703: <p><label>Course:
704: <select name="c">
705: <optgroup label="8.01 Physics I: Classical Mechanics">
706: <option value="8.01.1">Lecture 01: Powers of Ten
707: <option value="8.01.2">Lecture 02: 1D Kinematics
708: <option value="8.01.3">Lecture 03: Vectors
709: <optgroup label="8.02 Electricity and Magnestism">
710: <option value="8.02.1">Lecture 01: What holds our world together?
711: <option value="8.02.2">Lecture 02: Electric Field
712: <option value="8.02.3">Lecture 03: Electric Flux
713: <optgroup label="8.03 Physics III: Vibrations and Waves">
714: <option value="8.03.1">Lecture 01: Periodic Phenomenon
715: <option value="8.03.2">Lecture 02: Beats
716: <option value="8.03.3">Lecture 03: Forced Oscillations with Damping
717: </select>
718: </label>
1.55 mike 719: <p><input type=submit value="▶ Play">
1.9 mike 720: </form></pre>
721:
1.202 mike 722: </div><h4 id="the-option-element"><span class="secno">4.10.12 </span>The <dfn><code>option</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.9 mike 723: <dd>None.</dd>
1.203 mike 724: <dt>Contexts in which this element can be used:</dt>
1.156 mike 725: <dd>As a child of a <code><a href="#the-select-element" id="select-33">select</a></code> element.</dd>
726: <dd>As a child of a <code><a href="#the-datalist-element" id="datalist-17">datalist</a></code> element.</dd>
1.190 mike 727: <dd>As a child of an <code><a href="#the-optgroup-element" id="optgroup-9">optgroup</a></code> element.</dd>
1.9 mike 728: <dt>Content model:</dt>
1.156 mike 729: <dd><a href="content-models.html#text-content" id="text-content-4" title="text content">Text</a>.</dd>
1.9 mike 730: <dt>Content attributes:</dt>
1.156 mike 731: <dd><a href="elements.html#global-attributes" id="global-attributes-89">Global attributes</a></dd>
732: <dd><code title="attr-option-disabled"><a href="#attr-option-disabled" id="disabled-6">disabled</a></code></dd>
1.203 mike 733: <dd><code title="attr-option-label"><a href="#attr-option-label" id="label-29">label</a></code></dd>
1.156 mike 734: <dd><code title="attr-option-selected"><a href="#attr-option-selected" id="selected-0">selected</a></code></dd>
735: <dd><code title="attr-option-value"><a href="#attr-option-value" id="value-33">value</a></code></dd>
1.9 mike 736: <dt>DOM interface:</dt>
737: <dd>
1.162 mike 738: <pre class="idl">[NamedConstructor=<a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a>(),
739: NamedConstructor=<a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-t" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a>(in DOMString text),
740: NamedConstructor=<a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-tv" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a>(in DOMString text, in DOMString value),
741: NamedConstructor=<a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-tvd" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a>(in DOMString text, in DOMString value, in boolean defaultSelected),
742: NamedConstructor=<a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-tvds" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a>(in DOMString text, in DOMString value, in boolean defaultSelected, in boolean selected)]
1.156 mike 743: interface <dfn id="htmloptionelement">HTMLOptionElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-100">HTMLElement</a> {
1.162 mike 744: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-disabled" title='Read about this "disabled" reference in the full HTML5 spec.'>disabled</a>;
745: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-7">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
746: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-label" title='Read about this "label" reference in the full HTML5 spec.'>label</a>;
747: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-defaultselected" title='Read about this "defaultSelected" reference in the full HTML5 spec.'>defaultSelected</a>;
748: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-selected" title='Read about this "selected" reference in the full HTML5 spec.'>selected</a>;
749: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
1.9 mike 750:
1.162 mike 751: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-text" title='Read about this "text" reference in the full HTML5 spec.'>text</a>;
752: readonly attribute long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-index" title='Read about this "index" reference in the full HTML5 spec.'>index</a>;
1.9 mike 753: };</pre>
754: </dd>
1.191 mike 755: </dl><p>The <code><a href="#the-option-element" id="option-28">option</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> an option
1.156 mike 756: in a <code><a href="#the-select-element" id="select-34">select</a></code> element or as part of a list of suggestions
1.160 mike 757: in a <code><a href="#the-datalist-element" id="datalist-18">datalist</a></code> element.<p>In certain circumstances described in the definition of the
1.191 mike 758: <code><a href="#the-select-element" id="select-35">select</a></code> element, an <code><a href="#the-option-element" id="option-29">option</a></code> element can be a
1.156 mike 759: <code><a href="#the-select-element" id="select-36">select</a></code> element's <a href="#placeholder-label-option" id="placeholder-label-option-0">placeholder label option</a>.
760: A <a href="#placeholder-label-option" id="placeholder-label-option-1">placeholder label option</a> does not represent an actual
761: option, but instead represents a label for the <code><a href="#the-select-element" id="select-37">select</a></code>
1.160 mike 762: control.<p>The <dfn id="attr-option-disabled" title="attr-option-disabled"><code>disabled</code></dfn>
1.156 mike 763: attribute is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-16">boolean attribute</a>. An
1.191 mike 764: <code><a href="#the-option-element" id="option-30">option</a></code> element is <dfn id="concept-option-disabled" title="concept-option-disabled">disabled</dfn> if its <code title="attr-option-disabled"><a href="#attr-option-disabled" id="disabled-7">disabled</a></code> attribute is present or
1.190 mike 765: if it is a child of an <code><a href="#the-optgroup-element" id="optgroup-10">optgroup</a></code> element whose <code title="attr-optgroup-disabled"><a href="#attr-optgroup-disabled" id="disabled-4">disabled</a></code> attribute is
1.160 mike 766: present.<p>The <dfn id="attr-option-label" title="attr-option-label"><code>label</code></dfn>
1.191 mike 767: attribute provides a label for element. The <dfn id="concept-option-label" title="concept-option-label">label</dfn> of an <code><a href="#the-option-element" id="option-31">option</a></code>
1.203 mike 768: element is the value of the <code title="attr-option-label"><a href="#attr-option-label" id="label-30">label</a></code> attribute, if there is one,
1.162 mike 769: or the <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code> of the element, if there isn't.<p>The <dfn id="attr-option-value" title="attr-option-value"><code>value</code></dfn>
1.191 mike 770: attribute provides a value for element. The <dfn id="concept-option-value" title="concept-option-value">value</dfn> of an <code><a href="#the-option-element" id="option-32">option</a></code>
1.156 mike 771: element is the value of the <code title="attr-option-value"><a href="#attr-option-value" id="value-34">value</a></code> attribute, if there is one,
1.162 mike 772: or the <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code> of the element, if there isn't.<p>The <dfn id="attr-option-selected" title="attr-option-selected"><code>selected</code></dfn>
773: attribute represents the default <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#concept-option-selectedness" title='Read about this "selectedness" reference in the full HTML5 spec.'>selectedness</a> of the
1.160 mike 774: element.<p>A <code><a href="#the-select-element" id="select-38">select</a></code> element whose <code title="attr-select-multiple"><a href="#attr-select-multiple" id="multiple-34">multiple</a></code> attribute is not
1.191 mike 775: specified must not have more than one descendant <code><a href="#the-option-element" id="option-33">option</a></code>
1.156 mike 776: element with its <code title="attr-option-selected"><a href="#attr-option-selected" id="selected-1">selected</a></code>
1.162 mike 777: attribute set.<dl class="domintro"><dt><var title="">option</var> . <code title="dom-option-selected"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-selected" title='Read about this "selected" reference in the full HTML5 spec.'>selected</a></code></dt>
1.9 mike 778:
779: <dd>
780:
781: <p>Returns true if the element is selected, and false otherwise.</p>
782:
1.202 mike 783: <p>Can be set, to override the current state of the element.</p>
784:
1.9 mike 785: </dd>
786:
1.162 mike 787: <dt><var title="">option</var> . <code title="dom-option-index"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-index" title='Read about this "index" reference in the full HTML5 spec.'>index</a></code></dt>
1.9 mike 788:
789: <dd>
790:
1.156 mike 791: <p>Returns the index of the element in its <code><a href="#the-select-element" id="select-39">select</a></code>
1.162 mike 792: element's <code title="dom-select-options"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-options" title='Read about this "options" reference in the full HTML5 spec.'>options</a></code>
1.9 mike 793: list.</p>
794:
795: </dd>
796:
1.162 mike 797: <dt><var title="">option</var> . <code title="dom-option-form"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a></code></dt>
1.9 mike 798:
799: <dd>
800:
1.190 mike 801: <p>Returns the element's <code><a href="forms.html#the-form-element" id="form-23">form</a></code> element, if any, or
1.9 mike 802: null otherwise.</p>
803:
804: </dd>
805:
1.162 mike 806: <dt><var title="">option</var> . <code title="dom-option-text"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-text" title='Read about this "text" reference in the full HTML5 spec.'>text</a></code></dt>
1.11 mike 807:
808: <dd>
809:
1.206 mike 810: <p>Same as <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code>, except that spaces are collapsed.</p>
1.11 mike 811:
812: </dd>
813:
1.162 mike 814: <dt><var title="">option</var> = new <code title="dom-option"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a></code>( [ <var title="">text</var> [, <var title="">value</var> [, <var title="">defaultSelected</var> [, <var title="">selected</var> ] ] ] ] )</dt>
1.9 mike 815:
816: <dd>
817:
1.191 mike 818: <p>Returns a new <code><a href="#the-option-element" id="option-34">option</a></code> element.</p>
1.9 mike 819:
820: <p>The <var title="">text</var> argument sets the contents of the element.</p>
1.156 mike 821: <p>The <var title="">value</var> argument sets the <code title="attr-option-value"><a href="#attr-option-value" id="value-35">value</a></code> attribute.</p>
822: <p>The <var title="">defaultSelected</var> argument sets the <code title="attr-option-selected"><a href="#attr-option-selected" id="selected-2">selected</a></code> attribute.</p>
1.9 mike 823: <p>The <var title="">selected</var> argument sets whether or not the element is selected. If it is omitted, even if the <var title="">defaultSelected</var> argument is true, the element is not selected.</p>
824:
825: </dd>
826:
1.202 mike 827: </dl><h4 id="the-textarea-element"><span class="secno">4.10.13 </span>The <dfn><code>textarea</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.203 mike 828: <dd><a href="content-models.html#flow-content" id="flow-content-125">Flow content</a>.</dd>
829: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-135">Phrasing content</a>.</dd>
1.156 mike 830: <dd><a href="content-models.html#interactive-content" id="interactive-content-17">Interactive content</a>.</dd>
1.202 mike 831: <dd><a href="forms.html#category-listed" id="category-listed-7" title="category-listed">Listed</a>, <a href="forms.html#category-label" id="category-label-5" title="category-label">labelable</a>, <a href="forms.html#category-submit" id="category-submit-6" title="category-submit">submittable</a>, and <a href="forms.html#category-reset" id="category-reset-3" title="category-reset">resettable</a> <a href="forms.html#form-associated-element" id="form-associated-element-11">form-associated element</a>.</dd>
1.203 mike 832: <dt>Contexts in which this element can be used:</dt>
833: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-136">phrasing content</a> is expected.</dd>
1.9 mike 834: <dt>Content model:</dt>
1.156 mike 835: <dd><a href="content-models.html#text-content" id="text-content-5" title="text content">Text</a>.</dd>
1.9 mike 836: <dt>Content attributes:</dt>
1.156 mike 837: <dd><a href="elements.html#global-attributes" id="global-attributes-90">Global attributes</a></dd>
838: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-5">autofocus</a></code></dd>
839: <dd><code title="attr-textarea-cols"><a href="#attr-textarea-cols" id="cols">cols</a></code></dd>
840: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-16">disabled</a></code></dd>
1.190 mike 841: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-54">form</a></code></dd>
1.156 mike 842: <dd><code title="attr-textarea-maxlength"><a href="#attr-textarea-maxlength" id="maxlength-27">maxlength</a></code></dd>
843: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-41">name</a></code></dd>
844: <dd><code title="attr-textarea-placeholder"><a href="#attr-textarea-placeholder" id="placeholder-28">placeholder</a></code></dd>
1.187 mike 845: <dd><code title="attr-textarea-readonly"><a href="#attr-textarea-readonly" id="readonly-41">readonly</a></code></dd>
1.156 mike 846: <dd><code title="attr-textarea-required"><a href="#attr-textarea-required" id="required-30">required</a></code></dd>
847: <dd><code title="attr-textarea-rows"><a href="#attr-textarea-rows" id="rows">rows</a></code></dd>
848: <dd><code title="attr-textarea-wrap"><a href="#attr-textarea-wrap" id="wrap">wrap</a></code></dd>
1.9 mike 849: <dt>DOM interface:</dt>
850: <dd>
1.156 mike 851: <pre class="idl">interface <dfn id="htmltextareaelement">HTMLTextAreaElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-101">HTMLElement</a> {
1.162 mike 852: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.'>autofocus</a>;
853: attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-cols" title='Read about this "cols" reference in the full HTML5 spec.'>cols</a>;
854: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.'>disabled</a>;
855: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-8">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
856: attribute long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-maxlength" title='Read about this "maxLength" reference in the full HTML5 spec.'>maxLength</a>;
857: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.'>name</a>;
858: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-placeholder" title='Read about this "placeholder" reference in the full HTML5 spec.'>placeholder</a>;
859: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-readonly" title='Read about this "readOnly" reference in the full HTML5 spec.'>readOnly</a>;
860: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-required" title='Read about this "required" reference in the full HTML5 spec.'>required</a>;
861: attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-rows" title='Read about this "rows" reference in the full HTML5 spec.'>rows</a>;
862: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-wrap" title='Read about this "wrap" reference in the full HTML5 spec.'>wrap</a>;
863:
864: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a>;
865: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-defaultvalue" title='Read about this "defaultValue" reference in the full HTML5 spec.'>defaultValue</a>;
866: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
867: readonly attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-textlength" title='Read about this "textLength" reference in the full HTML5 spec.'>textLength</a>;
868:
869: readonly attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.'>willValidate</a>;
870: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.'>validity</a>;
871: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.'>validationMessage</a>;
872: boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.'>checkValidity</a>();
873: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.'>setCustomValidity</a>(in DOMString error);
874:
875: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
876:
877: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-select" title='Read about this "select" reference in the full HTML5 spec.'>select</a>();
878: attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-selectionstart" title='Read about this "selectionStart" reference in the full HTML5 spec.'>selectionStart</a>;
879: attribute unsigned long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-selectionend" title='Read about this "selectionEnd" reference in the full HTML5 spec.'>selectionEnd</a>;
880: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-setselectionrange" title='Read about this "setSelectionRange" reference in the full HTML5 spec.'>setSelectionRange</a>(in unsigned long start, in unsigned long end);
1.9 mike 881: };</pre>
882: </dd>
1.162 mike 883: </dl><p>The <code><a href="#the-textarea-element" id="textarea-21">textarea</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.9 mike 884: multiline plain text edit control. The contents of the control represent the
1.160 mike 885: control's default value.<p>The <dfn id="attr-textarea-readonly" title="attr-textarea-readonly"><code>readonly</code></dfn> attribute
1.156 mike 886: is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-17">boolean attribute</a> used to control whether the text
1.160 mike 887: can be edited by the user or not.<p>The <dfn id="attr-textarea-cols" title="attr-textarea-cols"><code>cols</code></dfn>
1.9 mike 888: attribute specifies the expected maximum number of characters per
1.156 mike 889: line. If the <code title="attr-textarea-cols"><a href="#attr-textarea-cols" id="cols-0">cols</a></code> attribute
890: is specified, its value must be a <a href="common-microsyntaxes.html#valid-non-negative-integer" id="valid-non-negative-integer-11">valid non-negative
1.160 mike 891: integer</a> greater than zero. <p>The <dfn id="attr-textarea-rows" title="attr-textarea-rows"><code>rows</code></dfn>
1.156 mike 892: attribute specifies the number of lines to show. If the <code title="attr-textarea-rows"><a href="#attr-textarea-rows" id="rows-0">rows</a></code> attribute is specified, its
893: value must be a <a href="common-microsyntaxes.html#valid-non-negative-integer" id="valid-non-negative-integer-12">valid non-negative integer</a> greater than
1.160 mike 894: zero. <p>The <dfn id="attr-textarea-wrap" title="attr-textarea-wrap"><code>wrap</code></dfn>
1.156 mike 895: attribute is an <a href="common-microsyntaxes.html#enumerated-attribute" id="enumerated-attribute-9">enumerated attribute</a> with two keywords
1.9 mike 896: and states: the <dfn id="attr-textarea-wrap-soft" title="attr-textarea-wrap-soft"><code>soft</code></dfn> keyword
1.198 mike 897: which maps to the <a href="#attr-textarea-wrap-soft-state" id="attr-textarea-wrap-soft-state-0" title="attr-textarea-wrap-soft-state">Soft</a> state, and the
1.9 mike 898: <dfn id="attr-textarea-wrap-hard" title="attr-textarea-wrap-hard"><code>hard</code></dfn> keyword
1.198 mike 899: which maps to the <a href="#attr-textarea-wrap-hard-state" id="attr-textarea-wrap-hard-state-0" title="attr-textarea-wrap-hard-state">Hard</a> state. The
900: <i>missing value default</i> is the <a href="#attr-textarea-wrap-soft-state" id="attr-textarea-wrap-soft-state-1" title="attr-textarea-wrap-soft-state">Soft</a> state.<p>The <dfn id="attr-textarea-wrap-soft-state" title="attr-textarea-wrap-soft-state">Soft</dfn> state
901: indicates that the text in the <code><a href="#the-textarea-element" id="textarea-22">textarea</a></code> is not to be
902: wrapped when it is submitted (though it can still be wrapped in the
903: rendering).<p>The <dfn id="attr-textarea-wrap-hard-state" title="attr-textarea-wrap-hard-state">Hard</dfn> state
904: indicates that the text in the <code><a href="#the-textarea-element" id="textarea-23">textarea</a></code> is to have
905: newlines added by the user agent so that the text is wrapped when it
906: is submitted.<p>If the element's <code title="attr-textarea-wrap"><a href="#attr-textarea-wrap" id="wrap-0">wrap</a></code>
907: attribute is in the <a href="#attr-textarea-wrap-hard-state" id="attr-textarea-wrap-hard-state-1" title="attr-textarea-wrap-hard-state">Hard</a> state, the <code title="attr-textarea-cols"><a href="#attr-textarea-cols" id="cols-1">cols</a></code> attribute must be
1.9 mike 908: specified.</p><!-- attr-textarea-wrap-off (attr-textarea-wrap-off-state): not
909: conforming; turns off the rendering of wrapping but otherwise acts
910: like 'soft' --><p>The <dfn id="attr-textarea-maxlength" title="attr-textarea-maxlength"><code>maxlength</code></dfn>
1.156 mike 911: attribute is a <a href="association-of-controls-and-forms.html#attr-fe-maxlength" id="attr-fe-maxlength-1" title="attr-fe-maxlength">form control <code title="">maxlength</code> attribute</a> controlled by the
1.198 mike 912: <code><a href="#the-textarea-element" id="textarea-24">textarea</a></code> element's <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#concept-textarea-dirty" title='Read about this "dirty value flag" reference in the full HTML5 spec.'>dirty value flag</a>.<p>If the <code><a href="#the-textarea-element" id="textarea-25">textarea</a></code> element has a <a href="association-of-controls-and-forms.html#maximum-allowed-value-length" id="maximum-allowed-value-length-2">maximum allowed
1.9 mike 913: value length</a>, then the element's children must be such that
1.162 mike 914: the <a class="full-spec-link" href="http://dev.w3.org/html5/spec/common-microsyntaxes.html#code-point-length" title='Read about this "code-point length" reference in the full HTML5 spec.'>code-point length</a> of the value of the element's
915: <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code> IDL attribute is equal to or less than the
1.160 mike 916: element's <a href="association-of-controls-and-forms.html#maximum-allowed-value-length" id="maximum-allowed-value-length-3">maximum allowed value length</a>.<p>The <dfn id="attr-textarea-required" title="attr-textarea-required"><code>required</code></dfn> attribute
1.156 mike 917: is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-18">boolean attribute</a>. When specified, the user will
1.9 mike 918: be required to enter a value before submitting the form.</p><!-- similar text in the <input> section --><p>The <dfn id="attr-textarea-placeholder" title="attr-textarea-placeholder"><code>placeholder</code></dfn>
919: attribute represents a hint (a word or short phrase) intended to aid
920: the user with data entry. A hint could be a sample value or a brief
921: description of the expected format. The attribute, if specified,
922: must have a value that contains no U+000A LINE FEED (LF) or U+000D
1.160 mike 923: CARRIAGE RETURN (CR) characters.<p class="note">For a longer hint or other advisory text, the <code title="attr-title"><a href="elements.html#the-title-attribute" id="title-26">title</a></code> attribute is more appropriate.<p>The <code title="attr-textarea-placeholder"><a href="#attr-textarea-placeholder" id="placeholder-29">placeholder</a></code>
1.9 mike 924: attribute should not be used as an alternative to a
1.190 mike 925: <code><a href="forms.html#the-label-element" id="label-16">label</a></code>.<p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-55">form</a></code> attribute is used to
1.198 mike 926: explicitly associate the <code><a href="#the-textarea-element" id="textarea-26">textarea</a></code> element with its
1.156 mike 927: <a href="association-of-controls-and-forms.html#form-owner" id="form-owner-10">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-42">name</a></code>
928: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-17">disabled</a></code> attribute is used to make
1.9 mike 929: the control non-interactive and to prevent its value from being
1.156 mike 930: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-6">autofocus</a></code>
1.160 mike 931: attribute controls focus.<dl class="domintro"><dt><var title="">textarea</var> . <code title="attr-textarea-type">type</code></dt>
1.9 mike 932:
933: <dd>
934:
935: <p>Returns the string "<code title="">textarea</code>".</p>
936:
937: </dd>
938:
939: <dt><var title="">textarea</var> . <code title="attr-textarea-value">value</code></dt>
940:
941: <dd>
942:
943: <p>Returns the current value of the element.</p>
944:
945: <p>Can be set, to change the value.</p>
946:
947: </dd>
948:
949: </dl><div class="example">
950:
1.198 mike 951: <p>Here is an example of a <code><a href="#the-textarea-element" id="textarea-27">textarea</a></code> being used for
1.9 mike 952: unrestricted free-form text input in a form:</p>
953:
954: <pre><p>If you have any comments, please let us know: <textarea cols=80 name=comments></textarea></p></pre>
955:
1.202 mike 956: </div><h4 id="the-keygen-element"><span class="secno">4.10.14 </span>The <dfn><code>keygen</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.203 mike 957: <dd><a href="content-models.html#flow-content" id="flow-content-126">Flow content</a>.</dd>
958: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-137">Phrasing content</a>.</dd>
1.156 mike 959: <dd><a href="content-models.html#interactive-content" id="interactive-content-18">Interactive content</a>.</dd>
1.202 mike 960: <dd><a href="forms.html#category-listed" id="category-listed-8" title="category-listed">Listed</a>, <a href="forms.html#category-label" id="category-label-6" title="category-label">labelable</a>, <a href="forms.html#category-submit" id="category-submit-7" title="category-submit">submittable</a>, and <a href="forms.html#category-reset" id="category-reset-4" title="category-reset">resettable</a> <a href="forms.html#form-associated-element" id="form-associated-element-12">form-associated element</a>.</dd>
1.203 mike 961: <dt>Contexts in which this element can be used:</dt>
962: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-138">phrasing content</a> is expected.</dd>
1.9 mike 963: <dt>Content model:</dt>
964: <dd>Empty.</dd>
965: <dt>Content attributes:</dt>
1.156 mike 966: <dd><a href="elements.html#global-attributes" id="global-attributes-91">Global attributes</a></dd>
967: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-7">autofocus</a></code></dd>
968: <dd><code title="attr-keygen-challenge"><a href="#attr-keygen-challenge" id="challenge">challenge</a></code></dd>
969: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-18">disabled</a></code></dd>
1.190 mike 970: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-56">form</a></code></dd>
1.156 mike 971: <dd><code title="attr-keygen-keytype"><a href="#attr-keygen-keytype" id="keytype">keytype</a></code></dd>
972: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-43">name</a></code></dd>
1.9 mike 973: <dt>DOM interface:</dt>
974: <dd>
1.156 mike 975: <pre class="idl">interface <dfn id="htmlkeygenelement">HTMLKeygenElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-102">HTMLElement</a> {
1.162 mike 976: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.'>autofocus</a>;
977: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-keygen-challenge" title='Read about this "challenge" reference in the full HTML5 spec.'>challenge</a>;
978: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.'>disabled</a>;
979: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-9">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
980: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-keygen-keytype" title='Read about this "keytype" reference in the full HTML5 spec.'>keytype</a>;
981: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.'>name</a>;
982:
983: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-keygen-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a>;
984:
985: readonly attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.'>willValidate</a>;
986: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.'>validity</a>;
987: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.'>validationMessage</a>;
988: boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.'>checkValidity</a>();
989: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.'>setCustomValidity</a>(in DOMString error);
1.9 mike 990:
1.162 mike 991: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
1.9 mike 992: };</pre>
993: </dd>
1.190 mike 994: </dl><p>The <code><a href="#the-keygen-element" id="keygen-12">keygen</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a key
1.9 mike 995: pair generator control. When the control's form is submitted, the
996: private key is stored in the local keystore, and the public key is
1.160 mike 997: packaged and sent to the server.<p>The <dfn id="attr-keygen-challenge" title="attr-keygen-challenge"><code>challenge</code></dfn> attribute
1.9 mike 998: may be specified. Its value will be packaged with the submitted
1.160 mike 999: key.<p>The <dfn id="attr-keygen-keytype" title="attr-keygen-keytype"><code>keytype</code></dfn>
1.156 mike 1000: attribute is an <a href="common-microsyntaxes.html#enumerated-attribute" id="enumerated-attribute-10">enumerated attribute</a>. The following
1.160 mike 1001: table lists the keywords and states for the attribute — the
1.9 mike 1002: keywords in the left column map to the states listed in the cell in
1003: the second column on the same row as the keyword. User agents are
1.26 mike 1004: not required to support these values, and must only recognize values
1.160 mike 1005: whose corresponding algorithms they support.<table><thead><tr><th> Keyword <th> State
1006: <tbody><tr><td> <code title="">rsa</code>
1007: <td> <i title="">RSA</i>
1.9 mike 1008: <!-- v2 (see below)
1009: <tr>
1010: <td> <code title="">ec</code>
1011: <td> <i title="">EC</i>
1012: -->
1.160 mike 1013: </table><p>The <i>invalid value default</i> state is the <i title="">unknown</i> state. The <i>missing value default</i> state
1014: is the <i title="">RSA</i> state, if it is supported, or the <i title="">unknown</i> state otherwise.<p class="note">This specification does not specify what key types
1015: user agents are to support — it is possible for a user agent
1.190 mike 1016: to not support any key types at all.<p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-57">form</a></code> attribute is used to
1017: explicitly associate the <code><a href="#the-keygen-element" id="keygen-13">keygen</a></code> element with its
1.156 mike 1018: <a href="association-of-controls-and-forms.html#form-owner" id="form-owner-11">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-44">name</a></code>
1019: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled" id="disabled-19">disabled</a></code> attribute is used to make
1.9 mike 1020: the control non-interactive and to prevent its value from being
1.156 mike 1021: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus" id="autofocus-8">autofocus</a></code>
1.160 mike 1022: attribute controls focus.<dl class="domintro"><dt><var title="">keygen</var> . <code title="attr-keygen-type">type</code></dt>
1.9 mike 1023:
1024: <dd>
1025:
1026: <p>Returns the string "<code title="">keygen</code>".</p>
1027:
1028: </dd>
1029:
1030: </dl><p class="note">This specification does not specify how the private
1031: key generated is to be used. It is expected that after receiving the
1.162 mike 1032: <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#signedpublickeyandchallenge" title='Read about this "SignedPublicKeyAndChallenge" reference in the full HTML5 spec.'>SignedPublicKeyAndChallenge</a></code> (SPKAC) structure, the
1.9 mike 1033: server will generate a client certificate and offer it back to the
1034: user for download; this certificate, once downloaded and stored in
1035: the key store along with the private key, can then be used to
1.88 mike 1036: authenticate to services that use TLS and certificate
1.9 mike 1037: authentication.</p><!-- how does the UA know which private key is associated with a
1038: certificate it gets back after the server has taken the public key
1039: created by <keygen> and turned it into a client cert? --><div class="example">
1040:
1041: <p>To generate a key pair, add the private key to the user's key
1042: store, and submit the public key to the server, markup such as the
1043: following can be used:</p>
1044:
1.22 mike 1045: <pre><form action="processkey.cgi" method="post" enctype="multipart/form-data">
1.9 mike 1046: <p><keygen name="key"></p>
1047: <p><input type=submit value="Submit key..."></p>
1048: </form></pre>
1049:
1050: <p>The server will then receive a form submission with a packaged
1051: RSA public key as the value of "<code title="">key</code>". This
1052: can then be used for various purposes, such as generating a client
1053: certificate, as mentioned above.</p>
1054:
1.202 mike 1055: </div><h4 id="the-output-element"><span class="secno">4.10.15 </span>The <dfn><code>output</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.203 mike 1056: <dd><a href="content-models.html#flow-content" id="flow-content-127">Flow content</a>.</dd>
1057: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-139">Phrasing content</a>.</dd>
1.202 mike 1058: <dd><a href="forms.html#category-listed" id="category-listed-9" title="category-listed">Listed</a>, <a href="forms.html#category-label" id="category-label-7" title="category-label">labelable</a>, and <a href="forms.html#category-reset" id="category-reset-5" title="category-reset">resettable</a> <a href="forms.html#form-associated-element" id="form-associated-element-13">form-associated element</a>.</dd>
1.203 mike 1059: <dt>Contexts in which this element can be used:</dt>
1060: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-140">phrasing content</a> is expected.</dd>
1.9 mike 1061: <dt>Content model:</dt>
1.203 mike 1062: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-141">Phrasing content</a>.</dd>
1.9 mike 1063: <dt>Content attributes:</dt>
1.156 mike 1064: <dd><a href="elements.html#global-attributes" id="global-attributes-92">Global attributes</a></dd>
1065: <dd><code title="attr-output-for"><a href="#attr-output-for" id="for-2">for</a></code></dd>
1.190 mike 1066: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-58">form</a></code></dd>
1.156 mike 1067: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-45">name</a></code></dd>
1.9 mike 1068: <dt>DOM interface:</dt>
1069: <dd>
1.156 mike 1070: <pre class="idl">interface <dfn id="htmloutputelement">HTMLOutputElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-103">HTMLElement</a> {
1.167 mike 1071: [PutForwards=<a class="full-spec-link" href="http://dev.w3.org/html5/spec/common-dom-interfaces.html#dom-domsettabletokenlist-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>] readonly attribute <a href="urls.html#domsettabletokenlist" id="domsettabletokenlist-5">DOMSettableTokenList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-htmlfor" title='Read about this "htmlFor" reference in the full HTML5 spec.'>htmlFor</a>;
1.162 mike 1072: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-10">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
1073: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.'>name</a>;
1074:
1075: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a>;
1076: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-defaultvalue" title='Read about this "defaultValue" reference in the full HTML5 spec.'>defaultValue</a>;
1077: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
1078:
1079: readonly attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.'>willValidate</a>;
1080: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.'>validity</a>;
1081: readonly attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.'>validationMessage</a>;
1082: boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.'>checkValidity</a>();
1083: void <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.'>setCustomValidity</a>(in DOMString error);
1.11 mike 1084:
1.162 mike 1085: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
1.9 mike 1086: };</pre>
1087: </dd>
1.162 mike 1088: </dl><p>The <code><a href="#the-output-element" id="output-11">output</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> the result of a
1.160 mike 1089: calculation.<p>The <dfn id="attr-output-for" title="attr-output-for"><code>for</code></dfn> content
1.9 mike 1090: attribute allows an explicit relationship to be made between the
1091: result of a calculation and the elements that represent the values
1092: that went into the calculation or that otherwise influenced the
1.156 mike 1093: calculation. The <code title="attr-output-for"><a href="#attr-output-for" id="for-3">for</a></code> attribute,
1094: if specified, must contain a string consisting of an <a href="common-microsyntaxes.html#unordered-set-of-unique-space-separated-tokens" id="unordered-set-of-unique-space-separated-tokens-2">unordered
1.9 mike 1095: set of unique space-separated tokens</a>, each of which must have
1.201 mike 1096: the value of an <a href="elements.html#concept-id" id="concept-id-19" title="concept-id">ID</a> of an element in the same
1.190 mike 1097: <code><a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#document" title='Read about this "Document" reference in the full HTML5 spec.'>Document</a></code>.<p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-59">form</a></code> attribute is used to
1.156 mike 1098: explicitly associate the <code><a href="#the-output-element" id="output-12">output</a></code> element with its
1099: <a href="association-of-controls-and-forms.html#form-owner" id="form-owner-12">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name" id="name-46">name</a></code>
1.162 mike 1100: attribute represents the element's name.<dl class="domintro"><dt><var title="">output</var> . <code title="dom-output-value"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 1101:
1102: <dd>
1103:
1104: <p>Returns the element's current value.</p>
1105:
1106: <p>Can be set, to change the value.</p>
1107:
1108: </dd>
1109:
1.162 mike 1110: <dt><var title="">output</var> . <code title="dom-output-defaultValue"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-defaultvalue" title='Read about this "defaultValue" reference in the full HTML5 spec.'>defaultValue</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 1111:
1112: <dd>
1113:
1114: <p>Returns the element's current default value.</p>
1115:
1116: <p>Can be set, to change the default value.</p>
1117:
1118: </dd>
1119:
1.162 mike 1120: <dt><var title="">output</var> . <code title="dom-output-type"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a></code></dt>
1.9 mike 1121:
1122: <dd>
1123:
1124: <p>Returns the string "<code title="">output</code>".</p>
1125:
1126: </dd>
1127:
1128: </dl><div class="example">
1129:
1.156 mike 1130: <p>A simple calculator could use <code><a href="#the-output-element" id="output-13">output</a></code> for its
1.9 mike 1131: display of calculated results:</p>
1132:
1133: <pre><form onsubmit="return false">
1134: <input name=a type=number step=any> +
1135: <input name=b type=number step=any> =
1.32 mike 1136: <output onforminput="value = a.valueAsNumber + b.valueAsNumber"></output>
1.9 mike 1137: </form></pre>
1138:
1.202 mike 1139: </div><h4 id="the-progress-element"><span class="secno">4.10.16 </span>The <dfn><code>progress</code></dfn> element</h4><p class="XXX annotation"><span><a href="http://www.w3.org/html/wg/tracker/issues/96">ISSUE-96</a> (progress) blocks progress to Last Call</span><dl class="element"><dt>Categories</dt>
1.203 mike 1140: <dd><a href="content-models.html#flow-content" id="flow-content-128">Flow content</a>.</dd>
1141: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-142">Phrasing content</a>.</dd>
1.202 mike 1142: <dd><a href="forms.html#category-label" id="category-label-8" title="category-label">Labelable</a> <a href="forms.html#form-associated-element" id="form-associated-element-14">form-associated element</a>.</dd>
1.203 mike 1143: <dt>Contexts in which this element can be used:</dt>
1144: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-143">phrasing content</a> is expected.</dd>
1.11 mike 1145: <dt>Content model:</dt>
1.203 mike 1146: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-144">Phrasing content</a>, but there must be no <code><a href="#the-progress-element" id="progress-8">progress</a></code> element descendants.</dd>
1.11 mike 1147: <dt>Content attributes:</dt>
1.156 mike 1148: <dd><a href="elements.html#global-attributes" id="global-attributes-93">Global attributes</a></dd>
1149: <dd><code title="attr-progress-value"><a href="#attr-progress-value" id="value-37">value</a></code></dd>
1150: <dd><code title="attr-progress-max"><a href="#attr-progress-max" id="max-36">max</a></code></dd>
1.190 mike 1151: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-60">form</a></code></dd>
1.11 mike 1152: <dt>DOM interface:</dt>
1153: <dd>
1.156 mike 1154: <pre class="idl">interface <dfn id="htmlprogresselement">HTMLProgressElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-104">HTMLElement</a> {
1.197 mike 1155: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
1156: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-max" title='Read about this "max" reference in the full HTML5 spec.'>max</a>;
1157: readonly attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-position" title='Read about this "position" reference in the full HTML5 spec.'>position</a>;
1.162 mike 1158: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-11">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
1159: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
1.11 mike 1160: };</pre>
1161: </dd>
1.162 mike 1162: </dl><p>The <code><a href="#the-progress-element" id="progress-9">progress</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> the
1.11 mike 1163: completion progress of a task. The progress is either indeterminate,
1164: indicating that progress is being made but that it is not clear how
1165: much more work remains to be done before the task is complete
1166: (e.g. because the task is waiting for a remote host to respond), or
1167: the progress is a number in the range zero to a maximum, giving the
1.160 mike 1168: fraction of work that has so far been completed.<p>There are two attributes that determine the current task
1169: completion represented by the element.<p>The <dfn id="attr-progress-value" title="attr-progress-value"><code>value</code></dfn>
1.11 mike 1170: attribute specifies how much of the task has been completed, and the
1171: <dfn id="attr-progress-max" title="attr-progress-max"><code>max</code></dfn> attribute
1172: specifies how much work the task requires in total. The units are
1.160 mike 1173: arbitrary and not specified.<p>Authors are encouraged to also include the current value and the
1.11 mike 1174: maximum value inline as text inside the element, so that the
1.160 mike 1175: progress is made available to users of legacy user agents.<div class="example">
1.11 mike 1176: <p>Here is a snippet of a Web application that shows the progress
1177: of some automated task:</p>
1178: <pre><section>
1179: <h2>Task Progress</h2>
1180: <p>Progress: <progress id="p" max=100><span>0</span>%</progress></p>
1181: <script>
1182: var progressBar = document.getElementById('p');
1183: function updateProgress(newValue) {
1184: progressBar.value = newValue;
1185: progressBar.getElementsByTagName('span')[0].textContent = newValue;
1186: }
1187: </script>
1188: </section></pre>
1189: <p>(The <code>updateProgress()</code> method in this example would
1190: be called by some other code on the page to update the actual
1191: progress bar as the task progressed.)</p>
1.156 mike 1192: </div><p>The <code title="attr-progress-value"><a href="#attr-progress-value" id="value-38">value</a></code> and <code title="attr-progress-max"><a href="#attr-progress-max" id="max-37">max</a></code> attributes, when present, must
1193: have values that are <a href="common-microsyntaxes.html#valid-floating-point-number" id="valid-floating-point-number-9" title="valid floating point number">valid
1194: floating point numbers</a>. The <code title="attr-progress-value"><a href="#attr-progress-value" id="value-39">value</a></code> attribute, if present, must
1.11 mike 1195: have a value equal to or greater than zero, and less than or equal
1.156 mike 1196: to the value of the <code title="attr-progress-max"><a href="#attr-progress-max" id="max-38">max</a></code>
1197: attribute, if present, or 1.0, otherwise. The <code title="attr-progress-max"><a href="#attr-progress-max" id="max-39">max</a></code> attribute, if present, must
1.160 mike 1198: have a value greater than zero.<p class="note">The <code><a href="#the-progress-element" id="progress-10">progress</a></code> element is the wrong
1.11 mike 1199: element to use for something that is just a gauge, as opposed to
1200: task progress. For instance, indicating disk space usage using
1.156 mike 1201: <code><a href="#the-progress-element" id="progress-11">progress</a></code> would be inappropriate. Instead, the
1.190 mike 1202: <code><a href="#the-meter-element" id="meter-8">meter</a></code> element is available for such use cases.<dl class="domintro"><dt><var title="">progress</var> . <code title="dom-progress-position"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-position" title='Read about this "position" reference in the full HTML5 spec.'>position</a></code></dt>
1.11 mike 1203:
1204: <dd>
1205:
1206: <p>For a determinate progress bar (one with known current and
1207: maximum values), returns the result of dividing the current value
1208: by the maximum value.</p>
1209:
1.160 mike 1210: <p>For an indeterminate progress bar, returns −1.</p>
1.11 mike 1211:
1.202 mike 1212: </dl><h4 id="the-meter-element"><span class="secno">4.10.17 </span>The <dfn><code>meter</code></dfn> element</h4><p class="XXX annotation"><span><a href="http://www.w3.org/html/wg/tracker/issues/97">ISSUE-97</a> (meter) blocks progress to Last Call</span></p><!-- Keep this after <progress> and NOT close to <time> --><dl class="element"><dt>Categories</dt>
1.203 mike 1213: <dd><a href="content-models.html#flow-content" id="flow-content-129">Flow content</a>.</dd>
1214: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-145">Phrasing content</a>.</dd>
1.202 mike 1215: <dd><a href="forms.html#category-label" id="category-label-9" title="category-label">Labelable</a> <a href="forms.html#form-associated-element" id="form-associated-element-15">form-associated element</a>.</dd>
1.203 mike 1216: <dt>Contexts in which this element can be used:</dt>
1217: <dd>Where <a href="content-models.html#phrasing-content" id="phrasing-content-146">phrasing content</a> is expected.</dd>
1.11 mike 1218: <dt>Content model:</dt>
1.203 mike 1219: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-147">Phrasing content</a>, but there must be no <code><a href="#the-meter-element" id="meter-9">meter</a></code> element descendants.</dd>
1.11 mike 1220: <dt>Content attributes:</dt>
1.156 mike 1221: <dd><a href="elements.html#global-attributes" id="global-attributes-94">Global attributes</a></dd>
1222: <dd><code title="attr-meter-value"><a href="#attr-meter-value" id="value-41">value</a></code></dd>
1223: <dd><code title="attr-meter-min"><a href="#attr-meter-min" id="min-38">min</a></code></dd>
1224: <dd><code title="attr-meter-max"><a href="#attr-meter-max" id="max-41">max</a></code></dd>
1225: <dd><code title="attr-meter-low"><a href="#attr-meter-low" id="low">low</a></code></dd>
1226: <dd><code title="attr-meter-high"><a href="#attr-meter-high" id="high">high</a></code></dd>
1227: <dd><code title="attr-meter-optimum"><a href="#attr-meter-optimum" id="optimum">optimum</a></code></dd>
1.190 mike 1228: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-61">form</a></code></dd>
1.11 mike 1229: <dt>DOM interface:</dt>
1230: <dd>
1.156 mike 1231: <pre class="idl">interface <dfn id="htmlmeterelement">HTMLMeterElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-105">HTMLElement</a> {
1.197 mike 1232: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
1233: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-min" title='Read about this "min" reference in the full HTML5 spec.'>min</a>;
1234: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-max" title='Read about this "max" reference in the full HTML5 spec.'>max</a>;
1235: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-low" title='Read about this "low" reference in the full HTML5 spec.'>low</a>;
1236: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-high" title='Read about this "high" reference in the full HTML5 spec.'>high</a>;
1237: attribute double <a class="full-spec-link" href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-optimum" title='Read about this "optimum" reference in the full HTML5 spec.'>optimum</a>;
1.162 mike 1238: readonly attribute <a href="forms.html#htmlformelement" id="htmlformelement-12">HTMLFormElement</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.'>form</a>;
1239: readonly attribute <a class="full-spec-link" href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a class="full-spec-link" href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.'>labels</a>;
1.11 mike 1240: };</pre>
1241: </dd>
1.190 mike 1242: </dl><p>The <code><a href="#the-meter-element" id="meter-10">meter</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a scalar
1.11 mike 1243: measurement within a known range, or a fractional value; for example
1244: disk usage, the relevance of a query result, or the fraction of a
1.190 mike 1245: voting population to have selected a particular candidate.<p>This is also known as a gauge.<p class="note">The <code><a href="#the-meter-element" id="meter-11">meter</a></code> element should not be used to
1.11 mike 1246: indicate progress (as in a progress bar). For that role, HTML
1.190 mike 1247: provides a separate <code><a href="#the-progress-element" id="progress-12">progress</a></code> element.<p class="note">The <code><a href="#the-meter-element" id="meter-12">meter</a></code> element also does not
1.160 mike 1248: represent a scalar value of arbitrary range — for example, it
1.11 mike 1249: would be wrong to use this to report a weight, or height, unless
1.160 mike 1250: there is a known maximum value.<p>There are six attributes that determine the semantics of the
1251: gauge represented by the element.<p>The <dfn id="attr-meter-min" title="attr-meter-min"><code>min</code></dfn> attribute
1.11 mike 1252: specifies the lower bound of the range, and the <dfn id="attr-meter-max" title="attr-meter-max"><code>max</code></dfn> attribute specifies
1253: the upper bound. The <dfn id="attr-meter-value" title="attr-meter-value"><code>value</code></dfn> attribute
1254: specifies the value to have the gauge indicate as the "measured"
1.160 mike 1255: value.<p>The other three attributes can be used to segment the gauge's
1.11 mike 1256: range into "low", "medium", and "high" parts, and to indicate which
1257: part of the gauge is the "optimum" part. The <dfn id="attr-meter-low" title="attr-meter-low"><code>low</code></dfn> attribute specifies
1258: the range that is considered to be the "low" part, and the <dfn id="attr-meter-high" title="attr-meter-high"><code>high</code></dfn> attribute specifies
1259: the range that is considered to be the "high" part. The <dfn id="attr-meter-optimum" title="attr-meter-optimum"><code>optimum</code></dfn> attribute
1260: gives the position that is "optimum"; if that is higher than the
1261: "high" value then this indicates that the higher the value, the
1262: better; if it's lower than the "low" mark then it indicates that
1263: lower values are better, and naturally if it is in between then it
1.160 mike 1264: indicates that neither high nor low values are good.<p> The <code title="attr-meter-value"><a href="#attr-meter-value" id="value-42">value</a></code> attribute must be
1.156 mike 1265: specified. The <code title="attr-meter-value"><a href="#attr-meter-value" id="value-43">value</a></code>, <code title="attr-meter-min"><a href="#attr-meter-min" id="min-39">min</a></code>, <code title="attr-meter-low"><a href="#attr-meter-low" id="low-0">low</a></code>, <code title="attr-meter-high"><a href="#attr-meter-high" id="high-0">high</a></code>, <code title="attr-meter-max"><a href="#attr-meter-max" id="max-42">max</a></code>, and <code title="attr-meter-optimum"><a href="#attr-meter-optimum" id="optimum-0">optimum</a></code> attributes, when present,
1266: must have values that are <a href="common-microsyntaxes.html#valid-floating-point-number" id="valid-floating-point-number-10" title="valid floating point
1.160 mike 1267: number">valid floating point numbers</a>.<p>In addition, the attributes' values are further constrained:<p>Let <var title="">value</var> be the <code title="attr-meter-value"><a href="#attr-meter-value" id="value-44">value</a></code> attribute's number.<p>If the <code title="attr-meter-min"><a href="#attr-meter-min" id="min-40">min</a></code> attribute
1.11 mike 1268: attribute is specified, then let <var title="">minimum</var> be that
1.160 mike 1269: attribute's value; otherwise, let it be zero.<p>If the <code title="attr-meter-max"><a href="#attr-meter-max" id="max-43">max</a></code> attribute
1.11 mike 1270: attribute is specified, then let <var title="">maximum</var> be that
1.160 mike 1271: attribute's value; otherwise, let it be 1.0.<p>The following inequalities must hold, as applicable:<ul class="brief"><li><var title="">minimum</var> ≤ <var title="">value</var> ≤ <var title="">maximum</var></li>
1272: <li><var title="">minimum</var> ≤ <code title="attr-meter-low"><a href="#attr-meter-low" id="low-1">low</a></code> ≤ <var title="">maximum</var> (if <code title="attr-meter-low"><a href="#attr-meter-low" id="low-2">low</a></code> is specified)</li>
1273: <li><var title="">minimum</var> ≤ <code title="attr-meter-high"><a href="#attr-meter-high" id="high-1">high</a></code> ≤ <var title="">maximum</var> (if <code title="attr-meter-high"><a href="#attr-meter-high" id="high-2">high</a></code> is specified)</li>
1274: <li><var title="">minimum</var> ≤ <code title="attr-meter-optimum"><a href="#attr-meter-optimum" id="optimum-1">optimum</a></code> ≤ <var title="">maximum</var> (if <code title="attr-meter-optimum"><a href="#attr-meter-optimum" id="optimum-2">optimum</a></code> is specified)</li>
1275: <li><code title="attr-meter-low"><a href="#attr-meter-low" id="low-3">low</a></code> ≤ <code title="attr-meter-high"><a href="#attr-meter-high" id="high-3">high</a></code> (if both <code title="attr-meter-low"><a href="#attr-meter-low" id="low-4">low</a></code> and <code title="attr-meter-high"><a href="#attr-meter-high" id="high-4">high</a></code> are specified)</li>
1.21 mike 1276: </ul><p class="note">If no minimum or maximum is specified, then the
1.11 mike 1277: range is assumed to be 0..1, and the value thus has to be within
1.160 mike 1278: that range.<p>Authors are encouraged to include a textual representation of the
1.11 mike 1279: gauge's state in the element's contents, for users of user agents
1.190 mike 1280: that do not support the <code><a href="#the-meter-element" id="meter-13">meter</a></code> element.<div class="example">
1.11 mike 1281:
1282: <p>The following examples show three gauges that would all be
1283: three-quarters full:</p>
1284:
1285: <pre>Storage space usage: <meter value=6 max=8>6 blocks used (out of 8 total)</meter>
1286: Voter turnout: <meter value=0.75><img alt="75%" src="graph75.png"></meter>
1287: Tickets sold: <meter min="0" max="100" value="75"></meter></pre>
1288:
1289: <p>The following example is incorrect use of the element, because
1290: it doesn't give a range (and since the default maximum is 1, both
1291: of the gauges would end up looking maxed out):</p>
1292:
1293: <pre class="bad"><p>The grapefruit pie had a radius of <meter value=12>12cm</meter>
1294: and a height of <meter value=2>2cm</meter>.</p> <!-- <strong>BAD!</strong> --></pre>
1295:
1296: <p>Instead, one would either not include the meter element, or use
1297: the meter element with a defined range to give the dimensions in
1298: context compared to other pies:</p>
1299:
1300: <pre><p>The grapefruit pie had a radius of 12cm and a height of
1301: 2cm.</p>
1302: <dl>
1303: <dt>Radius: <dd> <meter min=0 max=20 value=12>12cm</meter>
1304: <dt>Height: <dd> <meter min=0 max=10 value=2>2cm</meter>
1305: </dl></pre>
1306:
1307: </div><p>There is no explicit way to specify units in the
1.190 mike 1308: <code><a href="#the-meter-element" id="meter-14">meter</a></code> element, but the units may be specified in the
1.160 mike 1309: <code title="attr-title"><a href="elements.html#the-title-attribute" id="title-27">title</a></code> attribute in free-form text.<div class="example">
1.11 mike 1310:
1311: <p>The example above could be extended to mention the units:</p>
1312:
1313: <pre><dl>
1314: <dt>Radius: <dd> <meter min=0 max=20 value=12 title="centimeters">12cm</meter>
1315: <dt>Height: <dd> <meter min=0 max=10 value=2 title="centimeters">2cm</meter>
1316: </dl></pre>
1317:
1318: </div><div class="example">
1319: <p>The following markup:</p>
1320: <pre><h3>Suggested groups</h3>
1321: <menu type="toolbar">
1322: <a href="?cmd=hsg" onclick="hideSuggestedGroups()">Hide suggested groups</a>
1323: </menu>
1324: <ul>
1325: <li>
1326: <p><a href="/group/comp.infosystems.www.authoring.stylesheets/view">comp.infosystems.www.authoring.stylesheets</a> -
1327: <a href="/group/comp.infosystems.www.authoring.stylesheets/subscribe">join</a></p>
1328: <p>Group description: <strong>Layout/presentation on the WWW.</strong></p>
1329: <p><strong><meter value="0.5">Moderate activity,</meter></strong> Usenet, 618 subscribers</p>
1330: </li>
1331: <li>
1332: <p><a href="/group/netscape.public.mozilla.xpinstall/view">netscape.public.mozilla.xpinstall</a> -
1333: <a href="/group/netscape.public.mozilla.xpinstall/subscribe">join</a></p>
1334: <p>Group description: <strong>Mozilla XPInstall discussion.</strong></p>
1335: <p><strong><meter value="0.25">Low activity,</meter></strong> Usenet, 22 subscribers</p>
1336: </li>
1337: <li>
1338: <p><a href="/group/mozilla.dev.general/view">mozilla.dev.general</a> -
1339: <a href="/group/mozilla.dev.general/subscribe">join</a></p>
1340: <p><strong><meter value="0.25">Low activity,</meter></strong> Usenet, 66 subscribers</p>
1341: </li>
1342: </ul></pre>
1343: <p>Might be rendered as follows:</p>
1.203 mike 1344: <p><img alt="With the <meter> elements rendered as inline green bars of varying lengths." height="178" src="http://dev.w3.org/html5/spec/images/sample-meter.png" width="332"></p>
1.13 mike 1345: </div><p>User agents combine the value of
1.156 mike 1346: the <code title="attr-title"><a href="elements.html#the-title-attribute" id="title-28">title</a></code> attribute and the other
1.11 mike 1347: attributes to provide context-sensitive help or inline text
1.160 mike 1348: detailing the actual values.<div class="example">
1.11 mike 1349: <p>For example, the following snippet:</p>
1350: <pre><meter min=0 max=60 value=23.2 title=seconds></meter></pre>
1351: <p>...might cause the user agent to display a gauge with a tooltip
1352: saying "Value: 23.2 out of 60." on one line and "seconds" on a
1353: second line.</p>
1.190 mike 1354: </div><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form" id="form-62">form</a></code> attribute is used to
1355: explicitly associate the <code><a href="#the-meter-element" id="meter-15">meter</a></code> element with its
1.160 mike 1356: <a href="association-of-controls-and-forms.html#form-owner" id="form-owner-13">form owner</a>.<div class="example">
1.11 mike 1357:
1358: <p>The following example shows how a gauge could fall back to
1359: localized or pretty-printed text.</p>
1360:
1.160 mike 1361: <pre><p>Disk usage: <meter min=0 value=170261928 max=233257824>170 261 928 bytes used
1362: out of 233 257 824 bytes available</meter></p></pre>
1.11 mike 1363:
1.160 mike 1364: </div>
Webmaster