W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2006

[whatwg] getElementsByClassName()

From: Simon Pieters <zcorpan@hotmail.com>
Date: Sat, 04 Feb 2006 00:20:12 +0000
Message-ID: <BAY109-F4050DA29CD8E5F0CE124E0B40C0@phx.gbl>
Hi,

From: Michel Fortin <michel.fortin@michelf.com>
>I have a some markup like this:
>
>     <ul>
>         <li><a href="#tab1">Tab 1</a></li>
>         <li><a href="#tab2">Tab 2</a></li>
>     </ul>
>
>     <div id="tab1" class="pane">
>         ...
>     </div>
>
>     <div id="tab2" class="pane">
>         ...
>     </div>
>
>With the help of a style sheet, the script transforms this into some  sort 
>of tab view. It search for each div of class "pane". It looks  for links 
>pointing to each of these div elements and attach an event  to each so that 
>when you click on the link it shows the pane (and  hides other panes).

You could do this with the following CSS:

   .pane:not(:target) { display:none; }

Thus getElementsByClassName() is not needed for this use case.

Regards,
Simon Pieters
Received on Friday, 3 February 2006 16:20:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:26 UTC