Hi is there any way to check if an element like a progress bar has 100% width?
I've tried this but it does not work
let i = 0;
function start() {
if (i == 0){
i = 1;
let elem = document.getElementById("myBar");
let width = 10;
let id = setInterval(frame, 60);
function frame() {
if (elem.getAttribute("width") >= '100 %') {
document.getElementsByTagName('form')[0].submit();
clearInterval(id);
i = 0;
}
else {
width++;
elem.style.width = width + '%';
}
}
}
}
Edit: html Code:
<div id ="myProgress">
<div id="myBar"></div>
</div>