If element contains certain text
javascript, jquery
Solution
just use `:contains` pseudoclass
$('#example:contains("text")').addClass('test');
this will add the class to `#example` if it contains 'text'
Problem
``` $('.test').css('background','red'); <div id="example">Some text</div> ``` How can I `.addClass('test')` if `#example` contains the word "text"?