Reputation: 329
How to trigger function if string found in iframe within parent page ?
I need to alter this to work with string and not element ID:
if (window.frames[0].document.getElementById('mystring'))
{
document.getElementById('Search').style.display = 'block';}
Upvotes: 0
Views: 1108
Reputation: 82266
var source = window.frames[0].document.getElementsByTagName('html')[0].innerHTML;
var found = source.search("searchString");
you can also use source.indexOf("searchstring") != -1
Upvotes: 1