Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM Meter max Property

  • Difficulty Level : Basic
  • Last Updated : 10 Apr, 2019

The DOM Meter max Property is used to set or return the value of the max attribute of a gauge. The max attribute is used to specify the upper bound of the gauge and the value of the max attribute must be greater than the value of the min attribute. It has a default value which is 1.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

  • It return the max property.
    meterObject.max
  • It is used to set the max property.
    meterObject.max = number

Property values: It specifies a floating point number which represents the maximum value of the gauge It has a Default value which is 1.

Return Value: it returns a floating point number which represents the maximum value of the gauge.



Example-1: This Example returns a max Property.




<!DOCTYPE html>
<html>
  
<head>
    <title>
      DOM Meter max Property
  </title>
</head>
  
<body>
    <h1>
      GeeksforGeeks
  </h1>
    <h2>
      DOM Meter max Property:
  </h2> Sachin's score:
  
    <!-- assigning id to meter with 
        properties. -->
    <meter value="5" 
           min="0" 
           max="10">
        5 out of 10
    </meter>
  
    <br>Laxma score:
  
    <!-- meter tag using value property. -->
    <meter id="GFG" 
           min="20" 
           low="40" 
           high="65"
           max="100" 
           value="55">
  </meter>
    <br>
  
    <button onclick="Geeks()">
        Submit
    </button>
  
    <p id="sudo" 
       style="font-size:25px;
              color:green;">
  </p>
  
    <script>
        function Geeks() {
  
            // Accessing 'meter' tag. 
            var g =
                document.getElementById(
                  "GFG").max;
            document.getElementById(
              "sudo").innerHTML = g;
        }
    </script>
  
</body>
  
</html>

Output:
Before Clicking On Button:

After Clicking On Button :

Example-2: This Example sets the max Property.




<!DOCTYPE html>
<html>
  
<head>
    <title>
      DOM Meter max Property
  </title>
</head>
  
<body>
    <h1>
      GeeksforGeeks
  </h1>
    <h2>
      DOM Meter max Property:
  </h2> Sachin's score:
  
    <!-- assigning id to meter with 
        properties. -->
    <meter value="5"
           min="0"
           max="10">
        5 out of 10
    </meter>
  
    <br>Laxma score:
  
    <!-- meter tag using value property. -->
    <meter id="GFG" 
           min="20" 
           low="40" 
           high="65"
           max="100" 
           value="55">
  </meter>
    <br>
  
    <button onclick="Geeks()">
        Submit
    </button>
  
    <p id="sudo" 
       style="font-size:25px;
              color:green;">
  </p>
  
    <script>
        function Geeks() {
  
            // Accessing 'meter' tag. 
            var g =
                document.getElementById(
                  "GFG").max = "90";
            
            document.getElementById(
              "sudo").innerHTML = 
              "The value of the max attribute was changed to "
            + +g;
        }
    </script>
  
</body>
  
</html>

Output:
Before Clicking On Button:

After Clicking On Button:

Supported Browsers:

  • Mozilla Firefox
  • Google Chrome
  • Opera
  • Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :