title: Jquery trigger custom event in iframe window
body: <p>I'm having trouble triggering a custom event in an iframe from the parent document.</p>
  
  <p>In the child I have code like this:</p>
  
  <pre><code>$(window).on( 'my-event', function() { console.log( "GOT IT" ) } )
  </code></pre>
  
  <p>In the parent I get the iframe and try to send an event:</p>
  
  <pre><code>iframe = document.getElementById( 'content-frame' )
  $(iframe.contentWindow).trigger( 'my-event' )
  </code></pre>
  
  <p>The event doesn't arrive. I've tried using 'document' instead of window, but still without luck.</p>
  
  <p>Can this be done with jquery? </p>
  
  <p><em>I'm hoping there is a simple way so I can avoid writing a dispatch function whereby the parent calls a function in the iframe and it dispatches the event.</em></p>