Reputation: 1604
I have a div like this
<div parent_name='level1.3'><span>level1.3.1</span></div>
Now I am trying in JQuery
$("div:contains('level1.3.1')").show()
$("div:contains('<span>level1.3.1</span>')").show()
First One works but second one fails.
Upvotes: 1
Views: 45
Reputation: 18995
:contains()
escapes html entities, so you have to use :has()
first, to check if that div has the span, and then check if that span :contains()
the required text.
$("div:has(span:contains(level1.3.1))").show()
Upvotes: 3