I need to change content of page1 if page2 contain specified element. This code works great if I get id from the same page
if (document.getElementById(\"page
Think this will work...
var iframe = document.getElementById("iframeId"),
doc = getFrameDocument(iframe);
doc.getElementById("page2_element_id"); // [DOM Element]
function getFrameDocument(iframe){
return iframe.contentDocument ? iframe.contentDocument : iframe.contentWindow.document;
}
return cond ? a : b means:
if ( cond ) {
return a;
}
else {
return b;
}