+ 2
Why doesn’t my code work
https://code.sololearn.com/W1bs3sJGx67s/?ref=app I have a document.getElementById but it won’t show please help
2 ответов
+ 2
use "window.alert" or "console.log" instead of "document.write"
and also replace line 16 ( in js code ) by that:
document.getElementById("FA2").style.display = "block";
check this for more about diff between display and visibility
https://stackoverflow.com/questions/3475119/css-properties-display-vs-visibility
0
So you have an understanding why its not working as intended is because you are using document.write() in the hit() function.
document.write() clears all HTML from the document. This is why your call to display the FA2 isn't working, because the div has been cleared from the document.
https://www.w3schools.com/jsref/met_doc_write.asp