+ 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

4th Apr 2018, 11:02 AM
Kacper Orłowski
Kacper Orłowski - avatar
8 Réponses
+ 2
Hi, try skillBar.value = code;
4th Apr 2018, 11:16 AM
Johann
Johann - avatar
+ 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.
4th Apr 2018, 11:18 AM
Valérie SPICHER
+ 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
4th Apr 2018, 11:54 AM
Valérie SPICHER
0
Thank you both for helping. what is worng with window.onload?
4th Apr 2018, 11:45 AM
Kacper Orłowski
Kacper Orłowski - avatar
0
is it always recommended to put the entire JS in a function and call it in HTML?
4th Apr 2018, 11:49 AM
Kacper Orłowski
Kacper Orłowski - avatar
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
4th Apr 2018, 11:50 AM
Valérie SPICHER
0
ok. So I can use either window.onload or put the entire JS in a function and call it in HTML, right?
4th Apr 2018, 11:53 AM
Kacper Orłowski
Kacper Orłowski - avatar
0
right 👍
4th Apr 2018, 11:55 AM
Valérie SPICHER