title: Can't call a function from an iframe
body: <p>I have an window that is a sort of dashboard. Inside that dashboard i have an iframe that acts as a message centre for sending emails to users in the system.</p>
  
  <p>What i am trying to make:</p>
  
  <p>A drop down box that adds a recipient of the email to a text field when clicked in the drop down box.</p>
  
  <p>My current code:</p>
  
  <p>function in messages.js that outputs the users email as a test</p>
  
  <pre><code>function mountRecipient(user_email){
      window.parent.console.log(user_email);
  }
  </code></pre>
  
  <p>php that builds the <code>&lt;option&gt;</code> tags in the <code>&lt;select&gt;</code> tag. This is inside the iframe that holds the form for sending emails</p>
  
  <pre><code>function userDropDown() {
      $dbConn = getConnection();
      $sqlRequestUserList = "SELECT * FROM academy_user";
      $user_list = $dbConn-&gt;query($sqlRequestUserList);
  
      foreach ($user_list as $value) {
          printf('&lt;option onClick="mountRecipient(\'%s\');"&gt;%s %s: %s&lt;/option&gt;', $value['user_email'], $value['f_name'], $value['l_name'], $value['user_email']);
      }
  
  }
  </code></pre>
  
  <p>for some reason, when clicking the drop down item, the onclick event doesn't happen. If i type <code>mountRecipient(test)</code> into the chrome console then i get 'test' back from the script.</p>
  
  <p>Why is the onclick event not firing?</p>
  
  <p>(I tried to format the code but it wouldn't work, sorry)</p>