Finding Elements inside of a jQuery Object
<p>Let me start by saying im not 100% the way Im handling this is correct, but anyway..</p>

<p>I am loading HTML out of a file, into a string - and placing that string inside of a jquery object.</p>

<p>My HTML (example):</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
         ...
    &lt;link href="template.css" rel="stylesheet" type="text/css" /&gt;
    &lt;/head&gt;
    &lt;body&gt;

     &lt;img src="img.png"/&gt; 

     ...

     &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The above is in a variable called htmlstr:</p>

<pre><code>var htmlstr = theFunctionThatLoadsMyHTMLString();
$html = $(htmlstr);
</code></pre>

<p>Now, im going through the HTML and attempting to make some changes before I put it into an iframe.</p>

<p>This works perfectly fine for images:</p>

<pre><code> $html.find("img").each(function(){
      // do something
 });
</code></pre>

<p>But, when I try to access the LINK tag (to change the css href) it doesn't find "link".</p>

<pre><code> $html.find("link").each(function(){
      // do something
 });
</code></pre>

<p>To attempt to debug the problem, I wrote this code:</p>

<pre><code>$html.find('*').each(function(index){
    addline(index+': '+this.tagName+'');
});          
</code></pre>

<p>It prints out the HTML tag found for each element (addline is a function that does this). This is what I get:</p>

<pre><code>0: IMG
1: DIV
2: DIV
....
</code></pre>

<p>So it appears as if maybe its starting inside BODY for some reason, and ignoring the header?</p>

<p>What am I doing wrong here? </p>

<p>Im not gonna lie, Im not 100% sure how the $('code here') works in jQuery.. flying kind of blind.</p>
