Javascript examples for DOM:Document querySelectorAll
Hide multiple elements at once
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w ww . j a v a2 s. co m*/ var elems = document.querySelectorAll('p,li'); for(var i = 0;i < elems.length; i++) { elems[i].style.display = 'none'; } } </script> </head> <body> <p>1</p> <ul> <li>2</li> </ul> </body> </html>