0

I am wondering how I can hide all divs on the page only using Javascript, I cannot use Jquery. Is there a way to do this without using the arrays that comes with document.getElementByTag? Or if there is not, could you show me how to hide all? Thanks!

3
Contributors
4
Replies
7
Views
5 Years
Discussion Span
Last Post by iamthwee
0

Hi there,

You can use jQuery if you want some cool effects. have a look at jQuery

in pure javascript, you'd need something like the below code. This does what you want using ElementById. It is not gonna be hard then to work out what you exactly want to do.

 <script type="text/javascript">
    function hideMe()
    {
          document.getElementById('myDiv').style.display="hidden"   ;
    }
 </script>


   <body>

       <div id="myDiv"  onclick="return hideMe();">
               Hide me.
       </div>

   </body>

I hope this helps.

0

It's not by any choice of mine! The Studio that we use is written strangely, and I have not yet been able to implement JQuery on it. If I could/knew how to, believe me I'd be all over it!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.