jquery - Find element where child items h2 text has a specific value -
i think simple can't seem find right selector syntax. have html this:
<div class="parent"> <h2>summary</h2> <p>... bunch of content ...</p> </div> <div class="parent"> <h2>statistics</h2> <p>... bunch of content ...</p> </div> <div class="parent"> <h2>outcome</h2> <p>... bunch of content ...</p> </div>
i want find div h2 child contains text 'statistics'.
i tried various combinations of:
$(".parent").find("h2[text='statistics'").parent()
which doesn't work find returns empty set. if this:
$(".parent").find("h2").text("statistics").parent()
i 3 elements- of appear div containing statistics. add first() that, seems kind of gross. right syntax find 1 item?
Comments
Post a Comment