I have html code like below
<div id='p1'>
<p>First Paragraph</p>
<p>Abbot and Costello - Africa Screams</p>
</div>
<div id='p2'>
<p>Second Paragraph</p>
<p>Abbot and Costello - Frank/Meet</p>
</div>
<div id='p3'>
<p>Third Paragraph</p>
<p>addin</p>
</div>
<div id='p4'>
<p>Forth Paragraph</p>
<p>Begins</p>
</div>
I want to find a specific word like "addin" if it matches then I want to hide whole content with in <div id='p3'>
.
How can I achieve this using jQuery?
Any help would be Appreciated. Thanks in advance.
答案 0 :(得分:1)
$("p:contains('addin')").closest("div").hide();
此代码适合我!
答案 1 :(得分:-1)
尝试使用:
$("div p:contains('addin')").hide()