Question

I have some data in table like "< n/a>", and i need to get it by text in div, but don`t find how.

<div class="one">red</div>
<div class="one">green</div>
<div class="one"><n/a></div>

$("div.one:contains('<n/a>')")
Était-ce utile?

La solution

I don't think the problem is the selector, it is the html, you might have to escape the < and > like

<div class="one">&lt;n/a&gt;</div>

Demo: Fiddle


Your html renders the content <n/a> as html elements... see the difference between the escaped version and non escaped version

enter image description here

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top