Hide Child Based on Parent

Everything about using Adblock Plus on Google Chrome
Post Reply
Chris_Brackett
Posts: 1
Joined: Wed Mar 18, 2020 3:22 am

Hide Child Based on Parent

Post by Chris_Brackett »

Is it possible to hide a child element based on it's parent element? Here's a simplified example:

Code: Select all

<DIV class="example-div">
    <TABLE>
        <TR>
            <TD>
                <DIV>I want to hide this DIV because it is within (1) a cell (2) of a table (3) inside a DIV with class example-div.</SPAN>
            </TD>
        </TR>
    </TABLE>
</DIV>

<DIV>
    <TABLE>
        <TR>
            <TD>
                <DIV>I -don't- want to hide this DIV because it is -not- within (1) a cell (2) of a table (3) inside a DIV with class example-div.</SPAN>
            </TD>
        </TR>
    </TABLE>
</DIV>
I know that :-abp-has can be used to hide a parent based on a child record but I want to do the opposite. Thanks!
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: Hide Child Based on Parent

Post by greiner »

You can use regular CSS selectors for that which Adblock Plus supports out of the box. You can check out Mozilla's website where they have all sorts of documentation about what you can do with CSS selectors.

What you're searching for here is something along the lines of

Code: Select all

.example-div div
or

Code: Select all

.example-div > table > tr > td > div
.
Post Reply