+ 1

Changing css wtith JavaScript(display)

I know that we can change the Css properties with JavaScript codes. But, when I tries to change the display property to none, It doesn't work.

25th Jul 2018, 1:07 PM
Dri111
Dri111 - avatar
1 Odpowiedź
+ 2
<button onclick="onMsg()">Turn off Hello World</button> <h3 class="msg">Hello World!</h3> <script> function onMsg() { var element = document.querySelector(".msg"); element.style.display = "none"; } </script> https://code.sololearn.com/WY156d0sA0F1/?ref=app
25th Jul 2018, 1:48 PM
Calviղ
Calviղ - avatar