HTMLMeterElement: value property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since November 2015.
Thevalue property of theHTMLMeterElement interface represents the current value of the<meter> element as a floating-point number. It reflects the element'svalue attribute. If novalue is set, it is theHTMLMeterElement.min value or0, whichever is greater.
This property can also be set directly, for example to set a default value based on some condition.
In this article
Value
A number. Defaults to eitherHTMLMeterElement.min or0, whichever if greater, if not defined.
Examples
html
<label for="fuel">Current fuel level:</label><meter min="0" max="100" low="15" high="66" optimum="80" value="50"></meter>js
const meterElement = document.getElementById("fuel");console.log(meterElement.value); // 50--meterElement.value;console.log(meterElement.value); // 49Specifications
| Specification |
|---|
| HTML> # dom-meter-value> |