Trigger Custom Event From Iframe To Parent Document

iframe, javascript, jquery

Solution

This works:

parent.$('body').trigger('eventName');

the event triggered inside the iframe will be detected in the parent document.

Problem

I am having some trouble to fire a custom event inside an iframe and detect it from the parent document. Both iframe and parent document have the same origin (same protocol, same host, same port). Any advises?

Original source