I want a code that searches a html for a given string. The problem is that I don't have anything in my html file as you can see below. I only have script that displays RSS on my page. I need code that does this after my RSS is displayed.
I tried this code :
if (
document.getElementById('ElementName').innerHTML.indexOf('Text to search for') != -1) {
alert("FOUND!");
} else {
alert("NOT FOUND!");
}
But it doesnt work.
<!-- MY HTML BELOW -->
<!DOCTYPE html>
<html>
<head>
<meta charset ="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div style="display: flex; justify-content: center;">
<div class="weather" style="margin-top: 10%;">
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fmeteoalarm.eu%2Fdocuments%2Frss%2Frs%2FRS003.rss&chan=y&utf=y&html=a" charset="UTF-8" type="text/javascript"></script>
<noscript>
<a href="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fmeteoalarm.eu%2Fdocuments%2Frss%2Frs%2FRS003.rss&chan=y&utf=y&html=y">View RSS feed</a>
</noscript>
</div>
</div>
</body>
</html>