Why isnt the progress bar not loading | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
28th Jul 2017, 5:42 AM
Ishaq Za'rour
5 Answers
+ 2
You haven't linked Javascript to your html which is why pro() method is not getting any value to display.
28th Jul 2017, 6:51 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 2
You can define the pro() method as follows in Javascript section- window.onload = pro() { //method contents here. } And maybe you can have a while loop so as to stop once you reach 100%.
28th Jul 2017, 6:55 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 1
window.onload = function() { var pos = 0; var bar = document.getElementById('p1'); var t = setInterval(move, 50); function move() { if(pos >= 100) { clearInterval(t); } else { pos += 1; bar.value= pos; } } }; And on the html section, add id=p1 to progress tag. <progress id='p1'min="0" max="100" value="pro()"> You should be good.
28th Jul 2017, 7:30 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
0
Butbi used the return statement
28th Jul 2017, 6:52 AM
Ishaq Za'rour
0
If tried to make the return statement in the while loop but still not wotking
28th Jul 2017, 7:06 AM
Ishaq Za'rour