Can anyone tell me if it\'s possible to find an element based on its content rather than by an id or class?
I am attempting to find
The following jQuery selects div nodes that contain text but have no children, which are the leaf nodes of the DOM tree.
$('div:contains("test"):not(:has(*))').css('background-color', 'red');
div1
This is a test, nested in div1
Nested in div1
div2 test
This is another test, nested in div2
Nested in div2
div3