Hide div if under ordered list with class

- 1 answer

Ad

I am trying to hide a div that displays comment info if the comment is a child.

In the code below I am trying to make it so if "ol" has class of "children" then the div inside with the id "info" will be hidden.

Also open to other ways of hiding the div if the the comment is a child.

<ol class="children">
  <li class="comment byuser comment-author-1 bypostauthor odd alt depth-2" id="comment-325" itemprop="review" itemscope itemtype="http://schema.org/Review">
    <article id="comment-325" class="comment row">
      <header class="comment-author vcard col-md-2 col-sm-3 col-xs-12">
        <section class="comment-content comment col-md-10 col-sm-9 col-xs-12">
          <div class="comment-meta"></div>
          <div itemprop="reviewBody">
            <div class='edit-comment-admin-links-no-icon ' id='edit-comment-user-link-325' style='background:none'>
              <div style='display:none'>
                <p>asdsadasdsadasasdasdas
                  <div id="info" class="cio-display cio-display-0">
                    <div class="cio-display-start-new-row"></div>
                    <div class="cio-label cio-label-service-provided">Service Inquired About:</div>
                    <div class="cio-field cio-field-service-provided">Buy/Sell Commercial</div>
                    <div class="cio-display-start-new-row"></div>
                    <div class="cio-label cio-label-deal-completed">Deal Completed?</div>
                    <div class="cio-field cio-field-deal-completed">Yes</div>
                    <div class="cio-display-start-new-row"></div>
                    <div class="cio-label cio-label-date-of-service">Date Of Service:</div>
                    <div class="cio-field cio-field-date-of-service">2015</div>
                  </div>
              </div>
            </div>
          </div>
        </section>
      </header>
    </article>
  </li>
</ol>
Ad

Answer

Ad

Try $('ol.children #info').hide();

Ad
source: stackoverflow.com
Ad