title: How to attach an event to a button in an iframe
body: <p>Right now I have a jQuery UI dialog with an <code>&lt;iframe&gt;</code> inside of the dialog. When the user pushes a button, the dialog pops up with a form-editing screen in the iframe. </p>
  
  <p>Well, I want to have two buttons in the inner form-editing screen, "cancel" and "ok". Cancel doesn't save changes and closes the dialog, ok saves changes and closes the dialog. Pretty simple.. </p>
  
  <p>So how do I attach an event to the cancel button inside of the iframe from the parent page? I would also assume that you would somehow need to attach an event to the iframe's DOM-ready or else the button would not yet exist. </p>
  
  <p>How do you do this? </p>
  
  <p>Also, the iframe is on the same-domain and such so there is no cross-domain worries</p>
  
  <p>A simple example is here <a href="http://jsbin.com/omowi/8" rel="nofollow noreferrer">at jsbin</a> with the <a href="http://jsbin.com/ujubi4" rel="nofollow noreferrer">iframe source</a></p>