[Javascript] "display none" to all children

Billy Reisinger billy.reisinger at gmail.com
Wed May 30 20:54:07 CDT 2007


Taking it a step further, to hide only particular subsheets:
    <div id="sheet">
              <div class="subsheet hideable" id="subsheet1"></div>
              <div class="subsheet" id="subsheet2"></div>
              <div class="subsheet hideable" id="subsheet3"></div>
          </div>

#sheet.hideSubs div.hideable { display: none; }

Then add the "hideSubs" class name with javascript as Mike detailed  
below.

On May 30, 2007, at 9:00 AM, Mike Dougherty wrote:

> On 5/30/07, Paul Novitski <paul at juniperwebcraft.com> wrote:
>          <div id="sheet">
>              <div class="subsheet" id="subsheet1"></div>
>              <div class="subsheet" id="subsheet2"></div>
>              <div class="subsheet" id="subsheet3"></div>
>          </div>
>
> I believe what David Dorward was suggesting was something like this  
> (guessing)
> [CSS]
> #sheet.hideSubs div.subsheet { display: none; }
>
> [javascript]
> (hide) document.getElementById("sheet").className = "hideSubs";
> (show) document.getElementById("sheet).className = "";
>
> * caveat:  for the sake of simplicity, this example assumes #sheet  
> has only one className - but there may be an existing class on that  
> element, so it's probably better to have a routine that  
> intelligently manages the addition and removal of individual  
> classNames from the space-separated list.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list