i am trying to make a timer bar using this code :

```
var timer =  {
    elem: document.getElementById("myBar"),
    width:0,
    startTimer: setInterval(this.addWidth, 10),
    addWidth : function() {
        this.width += 0.01;
        this.elem.style.width = this.width + '%';
    },
    stopTimer: function() {
        clearInterval(this.startTimer);
        showModal();
    }
}

```

and here is the html 

```
var newHtml =   '<div id="myProgress">' +
                '<div id="myBar">' +
                '<div id="label"></div>' +
                '</div>' +
                '</div>';

```

later on i will add this to the document after adding the html to the page and using 

```
timer.startTimer

```

but it seems that the **setInterval()** is not working