+ 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
5 ответов
+ 5
There is an error can't set value null
https://code.sololearn.com/Wr1G3LUH2KxH/?ref=app
+ 5
It works fine! Thank You very much, Ipang!!!
+ 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";
}
+ 1
Line 12 and 16;
document.getElementById ('inpt').value = ...;
+ 1
No problem 👌