Javascript DOM HTML Meter Object get

Introduction

The Meter object represents an HTML <meter> element.

We can access a <meter> element via document.getElementById():

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

Click the button to get the current, "measured" value of the gauge.

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() {/*from   www.  ja va  2 s. c  o  m*/
  var x = document.getElementById("myMeter").value;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related