Javascript DOM HTML Meter value Property get

Introduction

Return the value attribute in a gauge:

var x = document.getElementById("myMeter").value;

Click the button to return the value attribute of the gauge above.

View in separate window

<!DOCTYPE html>
<html>
<body>

<p>My scale: <meter id="myMeter" min="0" low="40" high="95" max="100" value="65"></meter></p>

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

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

<script>
function myFunction() {/*  w w  w . ja v a  2  s  . co  m*/
  var x = document.getElementById("myMeter").value;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related