Jquery: Add IMG Alt text from H1
<p>All products have an H1 for header and I want to use that text for the alt text of the IMG.The script I wrote doesn't work. Can someone help me to get it right. SAMPLE of a single product is below more will be on a single page.</p>

<p>HTML </p>

<pre><code>&lt;li class="prod"&gt;
&lt;div class="mainpic"&gt;
      &lt;div class="popup"&gt;
          &lt;ul class="data"&gt;
             &lt;li&gt;feature 1&lt;/li&gt;
          &lt;/ul&gt;
      &lt;p&gt;SKU: 4430757&lt;/p&gt;
&lt;/div&gt;

&lt;img src="images/products/4330-12534-9126-333-TQ.jpg" width="220" height="210" 
alt="Some text" /&gt; 
&lt;/div&gt;

&lt;h1&gt;Avia  '5571' Women's Running Shoe&lt;/h1&gt;
&lt;/li&gt;
</code></pre>

<p>Script (is this correct?):</p>

<pre><code>var $target = null; 
var $newtext = null; 

$(".prod").each (function () { 

var target = $(this);

var newtext = target.find("h1").html();

target.each ( function () { 

$(this).find(img).attr(newtext);

});

    });
</code></pre>

<p>Thanks in advance!</p>
