+ 1
Using JS to change value of a progress bar.
Hi, I have been trying to change the value of a progress bar using user input. I can't seem to figure it out fully. Could you take a look at the code and see if you know the answer to my question? https://code.sololearn.com/WsM2dGQ3jp6P/?ref=app
8 Réponses
+ 2
Hi, try
skillBar.value = code;
+ 1
the line skillBar .value(code); isn't correct. write it like this skillBar .value=code;
/*
and you can't manipulate the DOM because your request are not detected in the html.
soluce : put your entire js in a function and call this function in tag <script>yourFunction();</script> before your ending tag body.
*/
edit: your call window.onload fix it too
if you want see exemples I do this in my codes here.
+ 1
no you don't always need to put your script in a global function.
generally your script is in an external file and you call it in your html file but here in the app not work like this you need to link the tab javacript with your tab html
0
Thank you both for helping. what is worng with window.onload?
0
is it always recommended to put the entire JS in a function and call it in HTML?
0
nothing wrong with window.onload it fix too the call of JS to manipulate the DOM
you don't need to call a function in a tag <script> with your call window.onload
0
ok. So I can use either window.onload or put the entire JS in a function and call it in HTML, right?
0
right 👍