Output type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Output

Description

The type property returns the type of Output object.

For an Output object, this property will always return "output".

Return Value

A String, representing the Output object's type

The following code shows how to check which HTML element the Output object represents:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
  <input type="range" id="a" value="50">100
  +<input type="number" id="b" value="50">
  =<output id="myOutput" name="x" for="a b"></output>
</form>//  w  w  w  .j a  v a  2 s  .co  m

<button type="button" onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myOutput").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials