I want to use $('body:contains("")') for searching part of a html code.
For example:
var thing = $('body:contains("Web</a></td></tr>")').text()
if(thing) {
alert(thing);
}
else{
alert("not found")
}
This code always alerts “not found”.
Is it possible to search a part of a html code and alert if found?
Thank you…
You can’t use selectors to look for HTML fragments, as no element contains the HTML fragment as text.
You can put the elements in the selector as elements, and look only for the text part of your HTML fragement: