Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
how to modify some js
y2kbg
New
I have this code:
That replicates whats in a div and increments the NAME of the elements. How can this be modifyied to increment the id also? I am really stuck on this.
function moreFields(readspot) {
counter++;
var newFields = document.getElementById(readspot).cloneNode(true);
newFields.id = '';
newFields.style.display = 'block';
var newField = newFields.childNodes;
for (var i=0;i<newField.length;i++) {
var theName = newField[i].name
if (theName){
newField[i].name = theName + counter;
}
}
var insertHere = document.getElementById('writeroot');
insertHere.parentNode.insertBefore(newFields,insertHere);
document.getElementById("total").value = counter;
}
That replicates whats in a div and increments the NAME of the elements. How can this be modifyied to increment the id also? I am really stuck on this.
0
This discussion has been closed.
Comments