Attempting to modify the CSS property using document.getElementById
, I wrote the following code:
var x = document.getElementById("id");
x.style.display = "none";
Unfortunately, this code is not functioning as expected.
Can someone provide insight into why this might be happening?
EXTRA INFO:
There are no error messages displayed - my code simply does not have any effect.
In addition, the <img>
tag is part of the element that I'm trying to target with document.getElementById
.
If that helps.