Javascript examples for CSS Style Property:display
Show and hide element by setting CSS style display
<html> <head> <title>Untitled</title> <script> function myFunction(){//from w w w .j ava 2 s. c o m var x=document.getElementsByClassName('demo')[0]; if(x.style.display==='none'){ x.style.display='block'; }else{ x.style.display='none'; } } </script> </head> <body> <ul> <li onclick="myFunction()"> THIS IS DEMO</li> </ul> <div class="demo"> Demo </div> </body> </html>