jQuery: Is there a way to make this shorter and more elegant?
<p>I have a code that looks like this:</p>

<pre><code>&lt;div id="wrapper"&gt;
     &lt;img id="first"  class="images" src="img/nike.jpg" /&gt;
     &lt;img  id ="second" class = "images" src="img/golden.jpg" /&gt;
     &lt;img id = "third" class ="images" src ="img/a.jpg" /&gt;
     &lt;img id = "fourth" class="images" src="img/God__s_Canvas_by_Delacorr.jpg" /&gt;
    &lt;/div&gt;
</code></pre>

<p>I want to wrap each img with <code>&lt;a name = n&gt;</code> dynamically. So my solution was to do this:</p>

<pre><code>$(".images").wrap('&lt;a&gt;&lt;/a&gt;')
$("#wrapper a").each(function(n) {
      $(this).attr('name', n);
     })
</code></pre>

<p>Is it possible to chain the 2 statements into 1 statement? I know that jQuery is particularly do elegant chaining so I think it's definitely possible. I just don't know how to yet.</p>
