Javascript .querySelector find <div> by innerTEXT
How can I find DIV with certain text? For example: <div> SomeText, text continues. </div> Trying to use something like this: var text = document.querySelector('div[SomeText*]').innerTEXT; alert(text); But ofcourse it will not work. How can I do it? gdyrrahitis OP's question is about plain JavaScript and not jQuery . Although there are plenty of answers and I like @Pawan Nogariya answer, please check this alternative out. You can use XPATH in JavaScript. More info on the MDN article here . The document.evaluate() method evaluates an XPATH query/expression. So you can pass XPATH expressions