Javascript Reference - HTML DOM Meter min Property








The min attribute from the meter element specifies the lower bound of the gauge, and the value must be less than the max attribute value.

The default min value is 0.

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

Browser Support

Meter min Yes No Yes Yes Yes

Syntax

Return the min property.

var v = meterObject.min

Set the min property.

meterObject.min=number




Property Values

Value Description
number Set the minimum value of the gauge. Default value is 0.

Return Value

A Number type value representing the minimum value of the gauge.

Example

The following code shows how to get the max attribute in a gauge.


<!DOCTYPE html>
<html>
<body>
<meter id="myMeter" min="0" low="40" high="95" max="100" value="65"></meter>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!--from  w  ww.  j  a v  a  2  s  . com-->
<script>
function myFunction() {
    var x = document.getElementById("myMeter").min;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to change the min attribute in a gauge.


<!DOCTYPE html>
<html>
<body>
<meter id="myMeter" min="0" low="40" high="75" max="100" value="65"></meter>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--   w ww .j  a v a 2  s  .c o  m-->
    document.getElementById("myMeter").min = "20";
}
</script>

</body>
</html>

The code above is rendered as follows: