0

I have a HTML structure like this:

<article class="post-content-area post type-post status-publish hentry"> 
    <div class="some-class">
        <div class="entry-content">
            content goes here
        </div>
    </div>
</article>

or

<article class="post-content-area post type-post status-publish hentry"> 
    <div class="entry-content">
        content goes here
    </div>
</article>

I need to select entry-content class that is inside a tag with post-content-area post type-post status-publish hentry classes, regardless of how nested entry-content is.

I've tried document.querySelectorAll("(post-content-area.post.type-post.status-publish.hentry)> .entry-content")

but it didn't work

Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
Mohammad Salehi
  • 565
  • 1
  • 12
  • 33
  • 3
    Try this `document.querySelectorAll(".post-content-area.post.type-post.status-publish.hentry .entry-content")` – Hassan Imam Jul 10 '20 at 11:08
  • 1
    If you are still unsure of why your selector does not work, check out: [What does the “>” (greater-than sign) CSS selector mean?](https://stackoverflow.com/questions/3225891/what-does-the-greater-than-sign-css-selector-mean) – Mr. Polywhirl Jul 10 '20 at 11:10
  • 1
    By the way, using parenthesis for a selector is not allowed - https://stackoverflow.com/questions/5478920/are-parentheses-allowed-in-css-selectors – goto Jul 10 '20 at 11:12
  • 1
    @HassanImam that's what I needed. thank you so much – Mohammad Salehi Jul 10 '20 at 11:18

0 Answers0