title: submit form from iframe and close it after submit and show a hidden div
body: <p>this is what I have</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;iframe id="myiframe"&gt;
      &lt;form id= "myform" action="submit.php" method="POST"&gt;
      &lt;input type="submit"&gt;
      &lt;/form&gt;&lt;/iframe&gt;
      &lt;div id="hiddendiv" style="display:none"&gt;
      some text
      &lt;/div&gt;
      &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>and this is what I want to end up with after the form in the iframe is submitted (ether by enter or just clicking the button submit, I do not care because the form only has 1 field)</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;
      //I want this iframe to become display:none or to be deleted
      /*&lt;iframe id="myiframe"&gt;
      &lt;form id= "myform" action="submit.php" method="POST"&gt;
      &lt;input type="submit"&gt;
      &lt;/form&gt;&lt;/iframe&gt;*/
      //and this div to be showed
      &lt;div id="hiddendiv" style="display:"&gt;
      some text
      &lt;/div&gt;
      &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>can anyone please help, thanks</p>
  
  <p>i have the answare but I have to wait for 8 h to post is so I edited the initial question, you can pot is if you want so I can validate it as a answare</p>
  
  <p>got it</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script&gt;
  
  function closeIframe() {
  var iframe = document.getElementById('myiframe');
  iframe.parentNode.removeChild(iframe);
  document.getElementById("hiddendiv").style.display="";
  }
  
  &lt;/script&gt;
  &lt;iframe id="myiframe"&gt;
  &lt;form id= "myform" action="submit.php" method="POST"&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;&lt;/iframe&gt;
  &lt;div id="hiddendiv" style="display:none"&gt;
  some text
  &lt;/div&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>and in the submit.php the return is this</p>
  
  <pre><code>echo '&lt;script type="text/javascript"&gt;';
  echo 'parent.closeIframe()';
  echo '&lt;/script&gt;';
  </code></pre>