I need to get the name of each input field within a row, and change it. I am having difficulty in finding the proper syntax to reference the name field. For example:
<tr id="row_0" class="dataRow">
<input type="text" class="tabcell" name="_0-3" size="6" value=7.0 />
<input type="text" class="tabcell" name="_0-7" size="6" value=7.6 />
I iterate over the rows and want to rename each td field:
var namePrefix = "AFS";
$('td:eq(0)', this).each(function(e) {
$('td:eq(0) input[name]', this).replaceWith($(namePrefix + 'td:eq(0) input', this).val());
.... etc ...
But this does not work. The end result should look like this:
<tr id="row_0" class="dataRow">
<input type="text" class="tabcell" name="AFS_0-3" size="6" value=7.0 />
<input type="text" class="tabcell" name="AFS_0-7" size="6" value=7.6/>
Anyone know how I can reference the input field name and change it?
Thanks.
Vic