0
Total output is not shown in textbox
the total units is not given as an output in the textbox https://code.sololearn.com/WQgQwp59LE8t/?ref=app for all inputs 1 the total units output must be 0.002
7 Respuestas
+ 2
The line it mentions has:
getElementById(...).value
The property it tried to access is 'value', which is a valid one for the element, but isn't for null. But why does it try null, instead of the element?
The catch: JS code loads before the HTML document. So the 'units' element just doesn't exist when the function runs, and getElement returns null.
Solution: wrap all JS code inside a block with onLoad condition. This tells the interpreter to only load the funcions when the page is fully loaded and all elements are there.
Check out some web stuff in the Code section to see it running.
+ 1
The link isn't working in the app. For a working link, tap "+" button, then Code, and select your code.
Plus: pls include in the question description a description of your task and your difficulties.
+ 1
Good.
I ran the code, and it gave an error. Did you see it?
+ 1
Do you understand the error and the cause?
0
Emerson Prado check now
0
Yeah it didn't get that one before
0
No