Finding Elements That Contain Some Specific Text With JQuery

Posted by Weston Ganger on April 19, 2016

I wanted to search the DOM for a specific piece of text.

Turns out this is super simple with the javascript contains selector

# Search all elements
$(":contains('some text')");

# Search only p elements
$("p:contains('some text')");

Good ol jQuery to the rescue!

Related External Links:

Posted in Javascript and Tagged with jquery javascript 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts