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
Rocket's answer doesn't work.
hhhhhh This is a test Another Div
I simply modified his DEMO here and you can see the root DOM is selected.
$('div:contains("test"):last').css('background-color', 'red');
add ":last" selector in the code to fix this.