title: how to select tags within an iframe using jquery?
body: <p>I'm trying to figure out how to select, and then modify, the HTML within an <code>iframe</code> I generate.  The iframe displays various media (images, pdfs, etc.).  To show different items, I initially create it using something like this:</p>
  
  <pre><code>$('#mydiv').html("&lt;iframe id='myiframe' src='path/file.jpg'&gt;&lt;/iframe&gt;");
  </code></pre>
  
  <p>and then, as needed, update its contents using something like this:</p>
  
  <pre><code>$('#myiframe').attr("src","path/newfile.jpg");
  </code></pre>
  
  <p>this produces HTML like this (as seen through Chrome's elements viewer):</p>
  
  <pre><code>&lt;div id='mydiv'&gt;
    &lt;iframe id='myiframe' src='path/file.jpg'&gt;
      #document
        &lt;html&gt;
          &lt;body style="margin:0"&gt;
            &lt;img style="-webkit-user-select:none" src="path/file.jpg"&gt;
          &lt;/body&gt;
        &lt;/html&gt;
    &lt;/iframe&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to select that dynamically generated <code>&lt;img&gt;</code> tag so that I can adjust its width.  But I can't figure out the jquery selector to do it.  Ideas?</p>