Having multiple identical IDs in a loop and using jQuery with them
<p>I have a loop that generates a bunch of these:</p>

<p><code>&lt;textarea id="uar"&gt;&lt;/textarea&gt;</code></p>

<p>The same loop generates a submit link next to each textarea.</p>

<p>That link will post this form:</p>

<pre><code>&lt;form action="php/unApprovePost.php" method="POST" id="unApprovePost"&gt;
   &lt;input type="hidden" id="uaid" name="uaid"/&gt;
   &lt;input type="hidden" id="uadc" name="uadc"/&gt;
&lt;/form&gt;
</code></pre>

<p>I populate <code>#uaid</code> successfully, but when I try to populate  <code>#uadc</code>, only the first iteration of the loop has functionality. What I mean is - only the first textarea will properly post what I want. If I try using any textareas other than the first one, they don't submit anything. I think it has something to do with the uniqueness of IDs in HTML. I tried using a class <code>.uar</code> but that doesn't really work either - same behavior. Any help?</p>

<p>Here's my jQuery code:</p>

<pre><code>    $('#unApprovePost').submit(function() {
        $('#uadc').val($('#uar').val());
    });
</code></pre>

<p><b>Edit:</b>
There is a dynamic amount of loop iterations, so I can't really have something like class="uar1". I tried making it class <code>.uar</code> for the textareas and using this jQuery code:</p>

<pre><code>$('#unApprovePost').submit(function() {
   $('#uadc').val($('.uar').val());
});
</code></pre>

<p>But the problem persists.</p>
