HTML <output> tag

HTML <output> tag : Definition

• The HTML <output> tag is generally used for displaying the result of a calculation(such as JavaScript).

• The <output> tag has been newly added in HTML5 and this element tag is used for complex calculations, like the results of an exchange rate conversion and so on.

Html <output> tag example 1:

<!DOCTYPE html>
<title>Output Tag example</title>
 <p class="paragraph">Sum of two Numbers</p>
 <form oninput="res.value=parseInt(a.value)+parseInt(b.value);">
  <label>Enter First Value.</label><br>
  <input type="number" name="a" value=""/><br>
  <label>Enter Second Value.</label><br> 
  <input type="number" name="b" value=""><br>
  Output is:<output name="res"></output>

Output :


Sum of two Numbers


Output is:

Html <output> tag example 2:

<!DOCTYPE html>

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" id="a" value="50">
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>

<p><strong>Note:</strong> The output element is not supported in Edge 12 (or earlier).</p>



+ Output: =

Note: The output element is not supported in Edge 12 (or earlier).