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 add button.
<input type="button" id="addButton" value="Add" onClick="appendRow();"/>
I need the appendRow() function to not only clone the previous line, but change its identifier and name to Id.1, Id.2, Comparator.1, Comparator.2, etc. Since some of the dropdown menus have so many meanings, it is not possible to create one giant append statement to recreate each line. How can I change the attributes of a clone when I create it? Thanks!
Edit: identifiers should be in the format .0, .1. This form submits a URL that reads them as such
Edit 2: Code
function appendRow() { $("QualificationRequirements").append($("QualificationRequirements tr:last").clone()); }
Do not try to change identifiers, just a simple clone function that I cannot get to work.
source share