+ 5

Why the buttons disappeared. I want they would be there and according to press it the result to be head or tail in the box?

I tried with Id but nothing came of it https://code.sololearn.com/WEpZv9AfLWva/?ref=app https://code.sololearn.com/Wr1G3LUH2KxH/?ref=app

23rd Jul 2020, 8:35 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
5 Réponses
+ 5
There is an error can't set value null https://code.sololearn.com/Wr1G3LUH2KxH/?ref=app
23rd Jul 2020, 7:00 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 5
It works fine! Thank You very much, Ipang!!!
24th Jul 2020, 5:53 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 4
The buttons disappear because the `document.write(...)` call in the JS section is rewriting the document content. Your "Press" button and the text input has the same ID, you need to assign different ID for those elements. Get a reference to the text input element, and update its 'value' property accordingly ... if(RandomNmbr < 0.5) { document.getElementById("head").value = "head"; } else { document.getElementById("head").value = "tail"; }
23rd Jul 2020, 9:13 AM
Ipang
+ 1
Line 12 and 16; document.getElementById ('inpt').value = ...;
23rd Jul 2020, 10:55 PM
Ipang
+ 1
No problem 👌
24th Jul 2020, 6:04 AM
Ipang