HTML <progress> id Attribute

An id on a <progress> tag assigns an identifier to the element.

The identifier must be unique across the page.



An id attribute on a <progress> element.

Loading files...
<div>Loading files... </div>
<progress id="load-progress" value="50" max="100"> 50% </progress>

Using id

The id attribute assigns an identifier to the <progress> element.

The id allows JavaScript to easily access the <progress> element.

It is also used to point to a specific id selector in a style sheet.

Tip:  id is a global attribute that can be applied to any HTML element.


<progress id="identifier" />



Value Description
identifier A unique alphanumeric string. The id value must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.).

More Examples

A <progress> element with a unique id attribute. The element is loading from 0 to 100% repeatedly. Clicking the button displays the current progress value.

Loading files...
<div>Loading files... </div>
<progress id="myprogress" max="100" value="50"> 50% </progress>

<br />
<button onclick="show();">Show progress value</button>


  setInterval( function(){
      let value = document.getElementById("myprogress").value;
      value = Math.min(value + .1, 100) % 100;
      document.getElementById("myprogress").value = value;
  }, 10 );

  let show = () => {
    let element = document.getElementById("myprogress");
    alert("Value = " + parseInt(element.value));


Code explanation

The id attribute assigns a unique identifier for the <progress>.

JavaScript locates the <progress> using the id.

It then increases the value of the <progress> by 1 each 10 milliseconds.

Browser support

Here is when id support started for each browser:

8.0 Dec 2010
16.0 Oct 2012
10.0 Sep 2012
11.0 Dec 2010
6.0 Jul 2012

You may also like

 Back to <progress>

Last updated on Sep 30, 2023