The <output> element represents the result of a calculation.
<output> |
Yes | Yes | Yes | Yes | Yes |
The <output> tag is new in HTML5.
Attribute | Value | Description |
---|---|---|
for | element_id | Set the relationship between the result and the elements |
form | form_id | Set one or more owner forms |
name | name | Set a name for the output element |
The <output> tag supports the Global Attributes in HTML.
The <output> tag supports the Event Attributes in HTML.
output { display: inline; }
A demo showing how to use <output> tag.
<!DOCTYPE HTML>
<html>
<body>
<form onsubmit="return false"
oninput="res.value = quant.valueAsNumber * price.valueAsNumber">
<fieldset>
<legend>Price Calculator</legend>
<input type="number"
placeholder="Quantity"
id="quant"
name="quant" />
x <!-- ww w .j a v a2s .co m-->
<input type="number"
placeholder="Price"
id="price"
name="price" />
=
<output for="quant name" name="res" />
</fieldset>
</form>
</body>
</html>