Reputation: 1652
I have a page which contains an iframe to another page, what I am looking for is to click something inside the iframe, which can then access or more specifically hide a div in the parent. I know some JQuery but for some reason just sit there blankly at the code editor when I try to write it on my own
Upvotes: 14
Views: 42964
Reputation: 47995
If both pages are on the same (sub)domain you should be able to access the parent window with:
window.parent.document.getElementById('divId')
Well this is without jQuery but should work
Upvotes: 0
Reputation: 318372
$("#element-In-Iframe").on('click', function() {
$('#element-in-parent-window', window.parent.document).hide();
});
Upvotes: 2
Reputation: 1395
try this in iframe:
$('#DIVtobehidden', window.parent.document).hide();
Upvotes: 34