title: Use jQuery to Insert HTML into an iFrame Body Tag
body: <p>I am using a hosted CMS that renders an iFrame within another iFrames. These iFrames are loaded from the same domain but since this is a hosted CMS I do not have access to these iFrames directly. Is it possible, using jQuery, to insert HTML content into the <code>body</code> tag of the iFrame with the id of <code>re_contentIframe</code>? </p>
  
  <p>Here is how the code renders on my site:</p>
  
  <pre><code>&lt;div class="editor"&gt;
    &lt;iframe id="editorf"  frameborder="0" src="/ForumEditor.aspx?ForumID=2221&amp;TopicID=-1&amp;NoTemplate=False&amp;Internal=False" style="display: inline;"&gt;
      &lt;html&gt;
        &lt;head&gt;&lt;/head&gt;
          &lt;body&gt;
            &lt;!-- CODE --&gt;
              &lt;iframe id="re_contentIframe" frameborder="0" src="javascript:'&lt;html&gt;&lt;/html&gt;';"&gt;
               &lt;html&gt;
                &lt;head&gt;&lt;/head&gt;
                 &lt;body&gt; &lt;!-- THIS IS WHAT I WANT TO TARGET --&gt; &lt;/body&gt;
               &lt;/html&gt;
              &lt;/iframe&gt;
            &lt;!-- CODE --&gt;
        &lt;/body&gt;
      &lt;/html&gt;
    &lt;/iframe&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried using the following code but nothing happens with this code (including no errors):</p>
  
  <pre><code>$(function() {
     $( "#test" ).click(function() {
         $("#re_contentIframe").contents().find("body").html("&lt;p&gt;new HTML content goes here&lt;/p&gt;");
     });
  });
  </code></pre>