Javascript DOM HTML Progress Object get

Introduction

The Progress object represents an HTML <progress> element.

The <progress> element represents the progress of a task.

We can access a <progress> element via document.getElementById():

var x = document.getElementById("myProgress");

Click the button to get the current progress value of the bar.

View in separate window

<!DOCTYPE html>
<html>
<body>
Downloading progress:/*from  w w w.  jav a2  s  .  co  m*/
<progress id="myProgress" value="75" max="100">
</progress>
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("myProgress").value;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related