title: jQuery - get an image src, and add to anchor tag outside the image
body: <p>I'm racking my brain trying to figure this one out. I have a variable number of thumbnails that have the same name as the full-size images, only in a different directory. I need to get the <code>&lt;img src=""&gt;</code> truncate it down to its filename (I'm using substring) and then add that to a path, and then apply it to the <code>&lt;a&gt;</code> tag outside of the image. </p>
  
  <p>Right now, I'm doing this:</p>
  
  <pre><code>$("#divName img").each(function(i, element){
  </code></pre>
  
  <p>To loop through each <code>&lt;IMG&gt;</code> tag.</p>
  
  <p>I'm getting the filename with:</p>
  
  <pre><code>$(element).attr("src").substring(92).
  </code></pre>
  
  <p>The document structure is something like this:</p>
  
  <pre><code>&lt;div id="divName"&gt;
     &lt;a href="url"&gt;&lt;img src="path"/&gt;&lt;/a&gt;&lt;br/&gt;
     &lt;a href="url"&gt;&lt;img src="path"/&gt;&lt;/a&gt;&lt;br/&gt;
     &lt;a href="url"&gt;&lt;img src="path"/&gt;&lt;/a&gt;&lt;br/&gt;
     &lt;a href="url"&gt;&lt;img src="path"/&gt;&lt;/a&gt;&lt;br/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So I need to get the value of "path" and add it to the "url" in the anchor tag outside of it for each one.</p>
  
  <p>I hope I've been clear. Please Help!  Thanks!  :)</p>