Find, replace in jquery for each element
<p>I have this in this var: "ver"
Here i have few lines like this one:</p>

<pre><code>&lt;div class="link" id="1"&gt;&lt;a ...&gt;Anchor&lt;/a&gt;&lt;/div&gt;
&lt;div class="link" id="2"&gt;&lt;a ...&gt;Anchor 2&lt;/a&gt;&lt;/div&gt;
</code></pre>

<p>I search a code in jquery that turn the above code into:</p>

<pre><code>&lt;div class="link" id="1"&gt;&lt;a ...&gt;&lt;img src="...?anchor=Anchor" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="link" id="1"&gt;&lt;a ...&gt;&lt;img src="...?anchor=Anchor 2" /&gt;&lt;/a&gt;&lt;/div&gt;
</code></pre>

<p>What i expect from the code: Find each Anchor - Get it - Generate an image that display this anchor.
PS: I have the function for "Image Generating".</p>

<p>SOLVED:</p>

<pre><code>$(".link").each(function(){

            anchor =  $(this).find('a').text();
             $(this).find('a').html('&lt;img src="generateLink.php?nr='+encodeURIComponent(anchor)+'" width="39" height="12"/&gt;');  

            });
</code></pre>
