title: Fire event of parent element in iframe
body: <p>I want to fire an event that is attached to a parent element (<code>div</code>) in <code>iframe</code>. The event is as follows:</p>
  <pre><code>$(document).on(&quot;keypress&quot;, &quot;.workingPage&quot;, function(event){
          alert(&quot;Test&quot;);
      });
  </code></pre>
  <p><strong>I've tried the following two methods:</strong></p>
  <p>1:  <code>parent.$('.workingPage').trigger('keypress');</code></p>
  <p>2: <code>$(&quot;.workingPage&quot;, parent.document).trigger(&quot;keypress&quot;);</code></p>
  <p>and I found the first one works, but the second one doesn't. Can anyone tell me why?</p>