Using Jquery to copy the values of multiple fields
<p>I'm trying to write a jquery funciton that will copy specified fields from the element above the current one into matching fields of the current element. Specifically I have a asp.net repeater that is spitting out tables with a few fields in it and I want a "Same as above" function. I'm still new to jquery though and I'm having some trouble with it. Here is some psudo code for what I'm currently trying to do feel free to propose a better method if you know it or simply fix this to work.</p>

<pre><code>function CopyPrevious(sender, rowId) {
    var current = $(sender).closest('#wrappingDiv').find('.containingTable').eq(rowId);
    var previous = $(sender).closest('#wrappingDiv').find('.containingTable').eq(rowId - 1);
    $(current).find('.fieldA').val($(previous).find('.fieldA').val());
}
</code></pre>

<p>wrappingDiv is just a div I put around the table so I could find it with "closest" and each table has the class "containingTable". I put "fieldA", "fieldB", etc as class names on the fields so I could find them to get the values.</p>

<p>The issue I'm having is a javascript error on row 4 of the above: $current is not defined</p>

<p>EDIT: Updated the line 4 per the comments. It works now. Thank you.</p>
