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: