HTML DOM Meter optimum Property

The HTML DOM Meter optimum property returns/sets a number corresponding to the optimum attribute of a <meter> element. Use this with high, low, min and max attributes for better results.

NOTE: Don’t use <meter> as a progress bar but only as a gauge.

Following is the syntax:

Returning value of the optimum property


Value of the optimum property set

meterElementObject.optimum = number

Let us see an example of Meter optimum property −


 Live Demo

<!DOCTYPE html>
<title>Meter optimum</title>
   form {
      margin: 0 auto;
      text-align: center;
   * {
      padding: 2px;
   input[type="button"] {
      border-radius: 10px;
         <label for="paulaLifeSource">Paula's Health Risk: </label>
         <meter id="paulaLifeSource" max="100" min="0" high="80" optimum="75" low="70" value="85">            </meter>
         <input type="button" onclick="lifeSource()" value="Rectify Optimum level">
         <div id="divDisplay"></div>
   var divDisplay = document.getElementById("divDisplay");
   divDisplay.textContent = 'Life Source at '+paulaLifeSource.value;
   function lifeSource(effect){
      var paulaLifeSource = document.getElementById("paulaLifeSource");
      var Immunity = paulaLifeSource.optimum;
      paulaLifeSource.optimum = 85;
      divDisplay.textContent = 'Optimum level changed to '+paulaLifeSource.optimum+' from '+Immunity;


Before clicking ‘Rectify Optimum level’ button −

After clicking ‘Rectify Optimum level’ button −