SyntaxFix
Write A Post
Hire A Developer
Questions
To get an element by its ID, use this:
document.getElementById("p2")
Instead of:
document.getElementsByName("p2")
So the final product would be:
document.getElementsById("p2").style.visibility = "hidden";