Open In App

HTML DOM Progress value Property

Last Updated : 21 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The Progress value Property in HTML DOM is used to set or return the value of the <progress> element. The value attribute is used to specify the completed task using a progress bar. 

Syntax

It returns a value property.

progressObject.value

It sets the value property.

progressObject.value = number

Property Values: It contains a numeric value that represents the status of the completed task of the progress bar.  

Return Value: It returns a Floating point number that specifies the status of the completed task of the Progress bar.

Example: Below code demonstrates how to display and set the value property.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Progress value Property
    </title>
</head>
 
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
 
        <h2>DOM Progress value Property </h2>
 
        Downloading progress for a song:
        <progress id="GFG" value="30" max="100">
        </progress>
 
        <br><br>
        <button onclick="display()">
            Display value
        </button>
         
        <button onclick="setvalue()">
            setting value
        </button>
    </center>
 
    <script>
        function display() {
            var pr = document.getElementById("GFG").value;
            alert("The current status of progress Bar is:" + pr)
        }
        function setvalue() {
            var gf = document.getElementById("GFG").max = "50";
            alert("The value of the progress Bar is:" + gf);
        }
    </script>
</body>
 
</html>


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Apple Safari


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads