Try this out 🙂
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example</title>
</head>
<body>
<div id="Content">
<div id="Panes"><div>
<h2>This is an example</h2>
<p><strong>Lorem Ipsum</strong>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nunc ante mauris, sollicitudin vel luctus ac, rhoncus eu est.
Sed fermentum est non pharetra viverra. Interdum et malesuada fames ac ante ipsum primis in faucibus.
Curabitur interdum metus non laoreet vehicula. Aliquam in lorem quis velit accumsan viverra.
Sed faucibus interdum augue non feugiat. Aliquam libero odio, malesuada aliquam sapien at, varius lobortis quam.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
Nullam vestibulum ultricies magna sit amet ultricies. Ut a nibh sodales, fringilla ipsum et, dapibus tortor.
</p>
</div>
</div>
<script>
var textYouWantToFind = "Lorem Ipsum";
var textExists = !!document.body.innerText.indexOf(textYouWantToFind);
if (textExists) {
alert("We have found " + textYouWantToFind + " !")
}
</script>
</body>
</html>
1
solved How do you alert user if a certain piece of text is present within HTML document using javascript?