Inserting HTML as a last child of a selected tag using JQuery
<p>I am new to JQuery. I'm reading JQuery in action, but only up to page 39 and need some quick help!</p>

<p>Please note: I'm simplifying my actual requirement, so what I'm asking for may sound odd but I'm just tryin to get to the crux of the JQuery expression and not my situation (related to an animation plugin).</p>

<p>I have my HTML code (which is generated and I dont want to change) :</p>

<pre><code>&lt;div class="favorite"&gt;
   &lt;div&gt;
          &lt;a href='http://www.stackoverflow.com'&gt;Stackoverflow&lt;/a&gt;
   &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now that I want to do is insert the text '(favorite)' INSIDE the A tag after the current contents. Or in other words as the last child of the <code>&lt;a&gt;</code>.</p>

<pre><code>&lt;div class="favorite"&gt;
   &lt;div&gt;
          &lt;a href='http://www.stackoverflow.com'&gt;Stackoverflow (favorite)&lt;/a&gt;
   &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>The best I have so far is this :</p>

<pre><code>$('&lt;span&gt; (favorite)&lt;/span&gt;').insertAfter('.favorite div a');
</code></pre>

<p>Of course this ends up putting the (favorite) text OUTSIDE the A link and it wont be underlined (which I want). </p>

<p>I need to somehow say .parent().lastChild() but I'm not quite sure how to do that.</p>

<p>Note: I had to put <code>&lt;span&gt;</code> in because otherwise it didnt see it as 'insertable' text. I'm sure there a way around that too but thats a secondary concern.</p>
