I have a section of html that looks like this:
<div id="faq-content">
<div class="faq-topic" >
<div id="faq-content-title">Top Questions</div>
<div class="faq-item"></div>
</div>
<div class="faq-topic">
<div id="faq-content-title">Returns</div>
<div class="faq-item"></div>
</div>
</div>
Given the text “Returns” or “Top Questions” how could I select its respective parent “faq-topic” div? I was able to select the “faq-content-title” div using $(‘.faq-content-title:contains(“Returns”)’), but I couldn’t figure out how to select the parent.
Thanks,
Tom
Anything wrong with using
$('.faq-content-title:contains("Returns")').parent()?