CSS Drilling Down

Given the following markup

<div class = "ColumnBox"</div>
         <div class = "HeadLeft"</div>
        <div class = "HeadRight"</div>
        <div class = "Clear"</div>
        <div class = "Inner"</div>
               <div class = "PollControl" </div>

How can I hide everything from ColumnBox to PollControl?

I would like to do this inside of the Jquery where I am showing and hiding the PollControl.

Thanks in advance
sherbug1015Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
Can you wrap it up in a container and show/hide class wrapper?
<div class="wrapper">
        <div class = "ColumnBox"></div>
         <div class = "HeadLeft"></div>
        <div class = "HeadRight"></div>
        <div class = "Clear"></div>
        <div class = "Inner"></div>
</div>
 <div class = "PollControl"></div>

Open in new window

0
sherbug1015Author Commented:
This is the wrapper which is why I asked how to drill down.    If I hide the ColumnBox, then there are lots of column boxes on the page as are lots of HeadLeft, etc.  I need to drill down to the PollControl div.
0
Tom BeckCommented:
The markup you posted is not valid so I need clarification. Is this the situation?
<div class = "ColumnBox">
        <div class = "HeadLeft"></div>
        <div class = "HeadRight"></div>
        <div class = "Clear"></div>
        <div class = "Inner"></div>
        <div class = "PollControl"></div>
</div>

Open in new window

ColumnBox is wrapping everything else?
How is PollControll show/hide triggered? From a button or link inside the PollControl div?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Mikkel SandbergFront End Developer (Contract)Commented:
So you want to hide HeadLeft, HeadRight, Clear and Inner, but keep PollControl visible?
0
Mikkel SandbergFront End Developer (Contract)Commented:
Or is this the markup?
<div class = "ColumnBox">
        <div class = "HeadLeft"></div>
        <div class = "HeadRight"></div>
        <div class = "Clear"></div>
        <div class = "Inner">
                <div class = "PollControl"></div>
        </div>
</div>

Open in new window

0
sherbug1015Author Commented:
Tom Beck/Mikkel Sandberg

I apologize.  here is the correct markup

<div class = "ColumnBox">
        <div class = "HeadLeft"</div>
        <div class = "HeadRight"</div>
        <div class = "Clear"</div>
        <div class = "Inner"</div>
             <div class = "PollControl" </div>
 </div>

No I want to be able to hide the entire thing.  The trigger will be based on a date that I am getting in another form.  I have a jquery that I am using to show/hide based on the date.  However when I hide the .PollControl, then the wrapper still remains.  I want the wrapper and the actual PollControl to hide.
0
Tom BeckCommented:
In jQuery, with $(this) representing the div.PollControl, then:
$(this).parent('div.ColumnBox').hide();

Open in new window

0
sherbug1015Author Commented:
I tried this and it doesn't work.  Nothing hides at all.  This script runs at document.ready so I don't think its going to know that $(this) is pointing to the PollControl.  Is there anyway to actually drill down from ColumnBox >*> PollControl inside a jquery script.
0
Tom BeckCommented:
I'm reacting to this:
However when I hide the .PollControl, then the wrapper still remains.
By this statement I surmise that you must already have a jQuery object representing the .PoolControl if you are able to hide it. I'm simply saying use the same object, move up in the DOM hierarchy to the parent of that object and hide the parent. Like:
$('.PollControl').parent('div.ColumnBox').hide();

Open in new window

Saying it doesn't work doesn't tell me much.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
$('.PollControl').closest('.ColumnBox').hide();

Open in new window

Full test code listing (with missing closing '>')

Click on document to hide entire ColumnBox.
<!doctype html>
<html>
<head>
<title>Test</title>
<style type="text/css">
</style>
</head>
<body>
<div class = "ColumnBox">
	<div class = "HeadLeft">one</div>
	<div class = "HeadRight">one</div>
	<div class = "Clear">one</div>
	<div class = "Inner">one</div>
             <div class = "PollControl">Poll Control </div>
 </div>
<div class = "ColumnBox">
	<div class = "HeadLeft">two</div>
	<div class = "HeadRight">two</div>
	<div class = "Clear">two</div>
	<div class = "Inner">two</div>
</div>
<div class = "ColumnBox">
	<div class = "HeadLeft">three</div>
	<div class = "HeadRight">three</div>
	<div class = "Clear">three</div>
	<div class = "Inner">three</div>
</div>
<script src="http://code.jquery.com/jquery.js"></script>

<script type="text/javascript">
$(function() {
	$(document).click(function() {
		$('.PollControl').closest('.ColumnBox').hide();
	});
});
</script>
</body>
</html>

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.