The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Display stylesheet attribute

Hi all,

I'm trying to add some debug functionality to a project I'm working on, in which debug messages can be printed as <div>s with a certain ID or class. The user can click on a link which triggers a function that changes the display property of the divs from "none" to "block"... Sounds fine so far, but there may be many divs on the same page with the same id, all of which need to be toggled when the user clicks on the link.

OK, so I just found out that the ID needs to be unique throughout the page. That means that every debug message that my JSP spits out will need to exist in a different named div. Is that right?

How would I show/hide all the different divs at once? Would I need to loop through them all? Can I use a common class in the stylesheet, and change its display attribute in a Javascript function, avoiding actually changing every div one-by-one?