Link to home
Start Free TrialLog in
Avatar of Nathan Riley
Nathan RileyFlag for United States of America

asked on

jQuery Parent Help

I have several instances of the following code on my page.  I want to hide the parent "raHolder" whenever the "checkDeny" or "check" div is clicked.

<div class="col-md-12 noPadLeft raHolder" style="margin-top:20px;padding-right:30px;">
                <div class="col-md-7" style="margin-bottom:10px;">
                    <img src="images/postedDateTwitter.png" style="margin-right:5px;">  <span class="postedDate">Scheduled for May 09 2015 at 02:00 PM</span>
                </div>
                <div class="clearfix"></div>
                <div class="col-md-12 borderB noPadLeft noPadRight" style="margin-left:15px;margin-right:15px;">
                    <div class="col-md-9 noPadLeft noPadRight" style="margin-bottom:20px;font-size:14px;color:#696a6c;">
                        Picture of logo.                    </div>
                    <div class="col-md-3  noPadLeft noPadRight text-right">
                        <div class="pull-right"><a href="#">EDIT</a></div><div class="checkDeny pull-right" style="margin-left:10px;margin-right:10px;"></div><div class="check pull-right"></div>
                    </div>
                </div>
            </div>

<div class="col-md-12 noPadLeft raHolder" style="margin-top:20px;padding-right:30px;">
                <div class="col-md-7" style="margin-bottom:10px;">
                    <img src="images/postedDateTwitter.png" style="margin-right:5px;">  <span class="postedDate">Scheduled for May 09 2015 at 02:00 PM</span>
                </div>
                <div class="clearfix"></div>
                <div class="col-md-12 borderB noPadLeft noPadRight" style="margin-left:15px;margin-right:15px;">
                    <div class="col-md-9 noPadLeft noPadRight" style="margin-bottom:20px;font-size:14px;color:#696a6c;">
                        Picture of logo.                    </div>
                    <div class="col-md-3  noPadLeft noPadRight text-right">
                        <div class="pull-right"><a href="#">EDIT</a></div><div class="checkDeny pull-right" style="margin-left:10px;margin-right:10px;"></div><div class="check pull-right"></div>
                    </div>
                </div>
            </div>

<div class="col-md-12 noPadLeft raHolder" style="margin-top:20px;padding-right:30px;">
                <div class="col-md-7" style="margin-bottom:10px;">
                    <img src="images/postedDateTwitter.png" style="margin-right:5px;">  <span class="postedDate">Scheduled for May 09 2015 at 02:00 PM</span>
                </div>
                <div class="clearfix"></div>
                <div class="col-md-12 borderB noPadLeft noPadRight" style="margin-left:15px;margin-right:15px;">
                    <div class="col-md-9 noPadLeft noPadRight" style="margin-bottom:20px;font-size:14px;color:#696a6c;">
                        Picture of logo.                    </div>
                    <div class="col-md-3  noPadLeft noPadRight text-right">
                        <div class="pull-right"><a href="#">EDIT</a></div><div class="checkDeny pull-right" style="margin-left:10px;margin-right:10px;"></div><div class="check pull-right"></div>
                    </div>
                </div>
            </div>

Open in new window


I know how to catch the click event, but not sure how to select the parent to be hidden.
ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada 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 Nathan Riley

ASKER

<script>
    $(".check").click(function(){
        $('.raHolder').hide();
    });
</script>

Open in new window


This hides all of them on the page, not just the parent.  Guessing it's a simple tweak to only hide the parent.
Perfect, thanks.
Continuation of the question if you know how to select an input value within the parent div.
https://www.experts-exchange.com/questions/28670532/jQuery-Selection-Help.html