Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

How can I make a class visible, even if the id within that class is set to hidden?

Here's my dilemma:

I've got some HTML that looks like this:

<div class="area"><div id="Florida">blahblahblah</div></div>

I've got two functions that look like this:

function area()
{
$('.area').show();
}

function Florida()
{
document.getElementById("Florida").style.display="none";
}

Both of these functions work great, but the problem happens when I click on my "Florida" function, which hides my "blahblahblah" content and then I try to click on my "area" function and nothing happens - which makes sense because my Florida content is currently hidden.

I realize I could hardwire my area function to trigger my Florida id as well, but I was hoping for something more elegant in that I've got several "state" ids and I want to set things up where there's a bit of a hierarchy so if the "area" function is clicked on, all of the ids within that class are automatically set to "inline." Is there such an animal or do I have to write out every state id individually?

What do you think?
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

Perfect!