Javascript DOM HTML Meter value Property set

Introduction

Change the value attribute in a gauge:

document.getElementById("myMeter").value = "50";

Click the button to change the value attribute 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() {//  w ww .j  ava  2 s  .c o  m
  document.getElementById("myMeter").value = "50";
  document.getElementById("demo").innerHTML = "The value of the value attribute was changed.";
}
</script>

</body>
</html>

The value property sets or gets the value attribute in a gauge.

The value attribute specifies the current, or "measured", value of the gauge.

It must be between the min and max attribute values.

The value attribute is a required attribute for the <meter> tag.




PreviousNext

Related