August 10, 200917 yr Hello! I'm just starting to learn JavaScript and I would like to set opacity of some element through JavaScript to 0, using GetElementById function. This is my short code: <script> document.getElementById("element").style.opacity="0"; </script> <div id="element"> noopacity </div> It doesn't seem to work, what am I doing wrong? Thanks.
August 10, 200917 yr Try setting the value as a number, not a string: document.getElementById("element").style.opacity=0;
Create an account or sign in to comment