首页 > 解决方案 > 使用 querySelectorAll 选择而不选择特定元素

问题描述

我有一个这样的 HTML 结构:

<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>

或者

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

无论嵌套如何,我都需要选择entry-content带有类的标签内的类。post-content-area post type-post status-publish hentryentry-content

我试过了document.querySelectorAll("(post-content-area.post.type-post.status-publish.hentry)> .entry-content")

但它没有用

标签: javascriptselectors-api

解决方案


推荐阅读