I have an iframe that loads by user request so its not available on first page load.
I want to be able to setup event listeners with the following 2 types of code:
$('iframe#joinIframe').contents().find('img#closePopUp').bind('click', function () {
console.log('iframe baby');
});
and
$('iframe#joinIframe img#closePopUp').bind('click', function() {
console.log('iframe baby');
});
however I get no reply.
Is there a way to have an initial page loaded, open an iframe later and bind events to this from the orginal page – I wanted to have some control/functionality from the underlying page.
thank you
Try the following: