Javascript DOM HTML Progress value Property get

Introduction

Get the current value of a progress bar:

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

Click the button to return the value attribute of the progress bar.

View in separate window

<!DOCTYPE html>
<html>
<body>

Downloading progress:/*  w  w  w .  j ava 2 s.  c om*/
<progress id="myProgress" value="22" 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