8
I have a table containing the following information:
<table id="Requirements">
<tr>
<td>
<select id="Id.0" name="Id.0" onChange="changeTextBox();">...
</td>
<td>
<select id="Comparator.0" name="Comparator.0" onChange="changeTextBox();">...
</td>
<td>
<input type="text" id="Integer.0" name="Integer.0"/>...
</td>
<td>
<select id="Value.0" name="Value.0">...
</td>
</tr>
</table>
and an add button.
<input type="button" id="addButton" value="Add" onClick="appendRow();"/>
I need the appendRow() function to not only clone the previous row, but change its id and name to Id.1, Id.2, Comparator.1, Comparator.2, etc. Because some of the drop down menus have so many values, it isn't feasible to create one giant append statement to recreate each row. How can I alter a clone's attributes upon creating it? Thanks!
Edit: The IDs must be in the .0, .1 format. This form posts to a URL that reads them as such
Edit 2: Code
function appendRow() {
$("QualificationRequirements").append($("QualificationRequirements tr:last").clone());
}
No attempt to change IDs, just a simple clone function that I can't get to work.