HTML 5 < output > Tag: The <output> element is used to define the result of particular calculations.The client-side script(Javascript) calculations are performed with the help of the <output> tag.
Usage and version of <output> tag in HTML 5
Placement | Inline |
Content | Inline and text |
Start/End Tag | Both start and end tags are required. |
Version | New in HTML5 |
HTML 5 < output > Tag Syntax
<output> ......... </output>
HTML 5 < output > Tag Example
<form oninput="result.value=parseInt(a.value)+parseInt(b.value)"> <input type="range" id="a" value="50"> + <input type="number" id="b" value="100"> = <output name="result" for="a b"></output> </form>
Tag-Specific Attributes
The following table specifies the attributes that are used to <output> tag.
ATTRIBUTE | VALUE | DESCRIPTION |
---|---|---|
for | element-id | Indicating the relationship between the result of the calculation and the elements contributed input values to this calculation. The value of this attribute can be a list of IDs of other elements. |
form | form-id | Specifies the form element that this element is associated with. |
name | name | Specify the name of the element. |
Global Attributes
The <output> tag supports the global attributes in HTML5 almost like all other HTML5 tags.
Event Attributes
The event attributes in HTML5 can be used in <output> tag.
Browser Compatibility
The <output> tag supports all modern browser and the list of browsers are as follows
- Google Chrome 10+
- Firefox4+
- Internet Explorer x
- Apple Safari 5.1+
- Opera 11+.