title: How to set id to an element in jquery?
body: <p>Basically I am creating x amount of image boxes using jquery <code>append()</code> function with all having the same class name, But now I need to set each box id to <code>i</code>. for avoiding confusion this is what I mean:</p>
  
  <pre><code>for(i=0;i&lt;10;i++){
      $('.d').append('&lt;img src="" class="UP__" width="120" height="120"&gt;');
      $('.d img').attr("id",i);
  }
  </code></pre>
  
  <p>The problem with above code i'm facing is that it sets all 10 <code>img</code> boxes <code>id</code> to <code>10</code>, But I need to set first box id to <code>1</code>, second to <code>2</code> and so on.</p>
  
  <p>My question is how to set each element id to value of <code>i</code>.</p>
  
  <p>Thanks in advance</p>