diff options
Diffstat (limited to 'devdocs/html/element%2Foutput.html')
| -rw-r--r-- | devdocs/html/element%2Foutput.html | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/devdocs/html/element%2Foutput.html b/devdocs/html/element%2Foutput.html new file mode 100644 index 00000000..6ecd439b --- /dev/null +++ b/devdocs/html/element%2Foutput.html @@ -0,0 +1,124 @@ +<header><h1><output>: The Output element</h1></header><div class="section-content"><p>The <code><output></code> <a href="../index">HTML</a> element is a container element into which a site or app can inject the results of a calculation or the outcome of a user action.</p></div> +<h2 id="attributes">Attributes</h2> +<div class="section-content"> +<p>This element includes the <a href="../global_attributes">global attributes</a>.</p> <dl> <dt id="for"><a href="#for"><code>for</code></a></dt> <dd> <p>A space-separated list of other elements' <a href="../global_attributes#id"><code>id</code></a>s, indicating that those elements contributed input values to (or otherwise affected) the calculation.</p> </dd> <dt id="form"><a href="#form"><code>form</code></a></dt> <dd> <p>The <a href="form"><code><form></code></a> element to associate the output with (its <em>form owner</em>). The value of this attribute must be the <a href="../global_attributes#id"><code>id</code></a> of a <code><form></code> in the same document. (If this attribute is not set, the <code><output></code> is associated with its ancestor <code><form></code> element, if any.)</p> <p>This attribute lets you associate <code><output></code> elements to <code><form></code>s anywhere in the document, not just inside a <code><form></code>. It can also override an ancestor <code><form></code> element.</p> </dd> <dt id="name"><a href="#name"><code>name</code></a></dt> <dd> <p>The element's name. Used in the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements"><code>form.elements</code></a> API.</p> </dd> </dl> <p>The <code><output></code> value, name, and contents are NOT submitted during form submission.</p> +</div> +<h2 id="examples">Examples</h2> +<div class="section-content"> +<p>In the following example, the form provides a slider whose value can range between <code>0</code> and <code>100</code>, and an <a href="input"><code><input></code></a> element into which you can enter a second number. The two numbers are added together, and the result is displayed in the <code><output></code> element each time the value of any of the controls changes.</p> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="E8BAOuvk/mX5mUmJ+nS516ASOd04vytU8mgzgZvVsvo=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>form</span> <span class="token attr-name">oninput</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>result.value=parseInt(a.value)+parseInt(b.value)<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>range<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>b<span class="token punctuation">"</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>b<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>50<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> + + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>number<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>a<span class="token punctuation">"</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>a<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>10<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> = + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>output</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>result<span class="token punctuation">"</span></span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>a b<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>60<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>output</span><span class="token punctuation">></span></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>form</span><span class="token punctuation">></span></span> +</pre> +</div> +</div> +<h3 id="result">Result</h3> +<div class="section-content"><div class="code-example" id="sect1"> + +<iframe class="sample-code-frame" title="Examples sample" id="frame_examples" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/output/runner.html?id=examples" loading="lazy"></iframe> +</div></div> +<h2 id="accessibility_concerns">Accessibility Concerns</h2> +<div class="section-content"><p>Many browsers implement this element as an <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions"><code>aria-live</code></a> region. Assistive technology will thereby announce the results of UI interactions posted inside it without requiring that focus is switched away from the controls that produce those results.</p></div> +<h2 id="technical_summary">Technical summary</h2> +<div class="section-content"><figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <th scope="row"><a href="../content_categories">Content categories</a></th> <td> <a href="../content_categories#flow_content">Flow content</a>, <a href="../content_categories#phrasing_content">phrasing content</a>, <a href="../content_categories#form_listed">listed</a>, <a href="../content_categories#form_labelable">labelable</a>, <a href="../content_categories#form_resettable">resettable</a> <a href="../content_categories#form-associated_content">form-associated element</a>, palpable content. </td> </tr> <tr> <th scope="row">Permitted content</th> <td> +<a href="../content_categories#phrasing_content">Phrasing content</a>.</td> </tr> <tr> <th scope="row">Tag omission</th> <td>None, both the starting and ending tag are mandatory.</td> </tr> <tr> <th scope="row">Permitted parents</th> <td> Any element that accepts <a href="../content_categories#phrasing_content">phrasing content</a>. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/status_role"><code>status</code></a></td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>Any</td> </tr> <tr> <th scope="row">DOM interface</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement"><code>HTMLOutputElement</code></a></td> </tr> </tbody> </table></div></figure></div> +<h2 id="specifications">Specifications</h2> +<div class="_table"><table class="standard-table"> +<thead><tr><th scope="col">Specification</th></tr></thead> +<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element">HTML Standard <br><small># the-output-element</small></a></td></tr></tbody> +</table></div> +<h2 id="browser_compatibility">Browser compatibility</h2> +<div class="_table"><table> +<thead> +<tr id="bct-browser-type"> +<th></th> +<th colspan="6">Desktop</th> +<th colspan="6">Mobile</th> +</tr> +<tr id="bct-browsers"> +<th></th> +<th>Chrome</th> +<th>Edge</th> +<th>Firefox</th> +<th>Internet Explorer</th> +<th>Opera</th> +<th>Safari</th> +<th>WebView Android</th> +<th>Chrome Android</th> +<th>Firefox for Android</th> +<th>Opera Android</th> +<th>Safari on IOS</th> +<th>Samsung Internet</th> +</tr> +</thead> +<tbody> +<tr> +<th><code>output</code></th> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">≤18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>for</code></th> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">≤18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>form</code></th> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">≤18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>name</code></th> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">≤18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">7</td> +<td class="bc-supports-yes">1.0</td> +</tr> +</tbody> +</table></div><div class="_attribution"> + <p class="_attribution-p"> + © 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br> + <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output</a> + </p> +</div> |
