HTML | DOM meter Object
The DOM Meter Object is used to represent the HTML <meter> element. The meter element is accessed by getElementById().
Properties:
- form: It belongs to one or more forms that it belongs too.
- max: It is used to specify the maximum value of a range.
- min: It is used to specify the minimum value of a range.
- high: It is used to specify the range considered to be a high value.
- low: It is used to specify the range value that is considered to be low.
- Optimum: It is used to specify the optimum value for the range.
- value: It is used to specify the required or actual value of the range.
Syntax:
document.getElementById("ID");
Where “id” is the ID assigned to the “meter” tag.
Example-1:
<!DOCTYPE html> <html> <head> <title>DOM Meter Object</title> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM Meter Object:</h2> Sachin's score: <!-- assigning id to meter with properties. --> <meter id="GFG" value="5" min="0" max="10"> 5 out of 10 </meter> <br>Laxma score: <!-- meter tag using value property. --> <meter value="0.5">50% from 100% </meter> <br> <button onclick="Geeks()"> Submit </button> <p id="sudo"></p> <script> function Geeks() { // Accessing 'meter' tag. var g = document.getElementById("GFG").value; document.getElementById("sudo").innerHTML = g; } </script> </body> </html> |
Output:
Before Clicking On Button :

After Clicking On Buttton:

Example-2: Meter Object can be created by using the document.createElement method.
<!DOCTYPE html> <html> <head> <title>DOM Meter Object</title> <style> body { font-size: 20px; } </style> </head> <body style="text-align:center;"> <form> <h1 style="color:green">GeeksforGeeks</h1> <h2>DOM Meter Object</h2> <p id="GFG">Sachins score:</p> </form> <button onclick="myGeeks()">Submit</button> <script> function myGeeks() { // Creating meter object using // document.createElement. var g = document.createElement("METER"); g.setAttribute("min", "0"); g.setAttribute("max", "10"); g.setAttribute("value", "5"); document.body.appendChild(g); } </script> </body> </html> |
Output:
Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browser supported by DOM Meter Object are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Meter low Property
- HTML <meter> min Attribute
- HTML | DOM Meter value Property
- HTML | DOM Meter min Property
- HTML | <meter> value Attribute
- HTML | DOM Meter max Property
- HTML | <meter> low Attribute
- HTML | <meter> max Attribute
- HTML | DOM Meter optimum Property
- HTML | DOM Meter high Property
- HTML | <meter> high Attribute
- HTML | <meter> form Attribute
- HTML | DOM Object Object
- HTML | DOM Pre Object
- HTML | DOM Ol Object
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



