How do I find the span containing the text "FIND ME"
<div> <span>FIND ME</span> <span>dont find me</span> </div>
http://api.jquery.com/contains-selector/
$("span:contains('FIND ME')")
ETA:
The contains selector is nice, but filtering a list of spans if probably quicker: http://jsperf.com/jquery-contains-vs-filter
$("span").filter(function() { return ($(this).text().indexOf('FIND ME') > -1) }); -- anywhere match $("span").filter(function() { return ($(this).text() === 'FIND ME') }); -- exact match
2.1m questions
2.1m answers
60 comments
57.0k users