Hello,
Hello,
I am creating a form and I have a field set for client information and the ability to add another field set for another client if needed.
As of now the additional field sets’ field id adds by 1 which is good, but I would like for each of the fields in the field set to add by 1 as well.
[CODE]var _counter = 0;
function Add() {
_counter++;
var oClone = document.getElementById(“client1”).cloneNode(true);
oClone.id += (_counter + “”);
document.getElementById(“placehere”).appendChild(oClone);
Here is what I’m getting:
The original section
[code=html]<fieldset id=”client1″>
<table id=”1″>
<tr>
<td>Child</td>
<td><select name=”pm1″ id=”pm1″><option value=”1″>Yes</option><option value=”2″>No</option></td>
</tr>
<td>Account</td>
<td><input type=”text” id=”pa1″ name=”pa1″ /></td>
</tr>
</table>
</fieldset>
The newly added section (Notice how the id is the same except for the fieldset)
[code=html]<fieldset id=”client2″>
<table id=”1″>
<tr>
<td>Child</td>
<td><select name=”pm1″ id=”pm1″><option value=”1″>Yes</option><option value=”2″>No</option></td>
<td>Account</td>
<td><input type=”text” id=”pa1″ name=”pa1″ /></td>
</tr>
</table>
</fieldset>
What I want
[code=html]
<fieldset id=”client2″>
<table id=”1″>
<tr>
<td>Child</td>
<td><select name=”pm2″ id=”pm2″><option value=”1″>Yes</option><option value=”2″>No</option></td>
<td>Account</td>
<td><input type=”text” id=”pa2″ name=”pa2″ /></td>
</tr>
</table>
</fieldset>