I have a loop that generates a bunch of these:
<textarea id="uar"></textarea>
The same loop generates a submit link next to each textarea.
That link will post this form:
<form action="php/unApprovePost.php" method="POST" id="unApprovePost">
<input type="hidden" id="uaid" name="uaid"/>
<input type="hidden" id="uadc" name="uadc"/>
</form>
I populate #uaid successfully, but when I try to populate #uadc, 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 .uar but that doesn't really work either - same behavior. Any help?
Here's my jQuery code:
$('#unApprovePost').submit(function() {
$('#uadc').val($('#uar').val());
});
Edit:
There is a dynamic amount of loop iterations, so I can't really have something like class="uar1". I tried making it class .uar for the textareas and using this jQuery code:
$('#unApprovePost').submit(function() {
$('#uadc').val($('.uar').val());
});
But the problem persists.