5 Replies Latest reply: Jan 24, 2011 1:21 PM by luadke RSS

    Is the a 'hid all' function in javascript

    luadke Community Member

      Hi,

       

      I have a menu system that toggles the visibility of different divs. Here is an example of how my javascript is now:

       

                $("#one").click(function() {
                          
                           $("#m").hide("fast");
                           $("#n").hide("fast");
                           $("#o").hide("fast");
                           $("p").hide("fast");
                           $("qx").hide("fast");
                           $("rx").hide("fast");
                           $("sx").hide("fast");
                                       $("#one").toggle("fast");
                     return false;
                });
      

       

      Is there any way that I can make it so it hides all divs and then toggles the one I want WITHOUT having to write it out like this. is there a 'hide all' option?

       

      Because obviously this is a really clunky way to do it and it takes a lifetime to update each time.

       

      Many thanks

      (the page is http://blackpaint.co.uk/new/)