I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at weston@westonganger.com. Thanks in advance for any leads!

Finding Elements That Contain Some Specific Text With JQuery

Posted by Weston Ganger

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:

Article Topic:Software Development - Javascript

Date:April 19, 2016

Recommended Posts