jQuery selector depending on the value of the span tag
<p>Supposing I have this HTML:</p>

<pre><code>&lt;div id="mydiv"&gt;
&lt;p&gt;
&lt;span&gt;My first span&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span&gt;My second span&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span&gt;My third span&lt;/span&gt;
&lt;/p&gt;
</code></pre>

<p>My problem is that I'm appending HTML to the p tags:</p>

<pre><code>$('#mydiv p').append('&lt;img src="http://example.com/myimage.png"&gt;');
</code></pre>

<p>But I only want to append to the second p with the span tag text "My second span" (or any other p tags with their respective span text depending on my application). so this is the resulting HTML after appending:</p>

<pre><code>&lt;p&gt;
&lt;span&gt;My second span&lt;/span&gt;&lt;img src="http://example.com/myimage.png"&gt;
&lt;/p&gt;
</code></pre>

<p>One limitation is that I cannot edit the original HTML sourcecode so I cannot assign class or ID selectors to them.</p>

<p>How would I revise my jQuery selectors to target a specific p with the specific span text? Thanks for any tips.</p>
