+ 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.
1 Antwort
+ 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