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

Contact

604-309-8713
info@solidfoundationwebdev.com

Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected