display a content of div element using js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

display a content of div element using js

<button onclick = "test1();">Test</button> <div id = " test1" style = "display:none;">Hai there...</div> <script> function test1(){ document.getElementById(" test1"). style.display; } </script> doesnt work... (meanwhile you are reading this i'm still searching the solution on google... but still please help me ;) )

26th Sep 2017, 3:07 PM
boyd
boyd - avatar
1 Answer
+ 6
id=" test1" is wrong, should be id="test". ....style.display = "block"; // you forgot to assign display property.
26th Sep 2017, 3:19 PM
Calviղ
Calviղ - avatar