Skip to content

Instantly share code, notes, and snippets.

@thrasibule
Created November 6, 2017 22:49
Show Gist options
  • Save thrasibule/3e498a1ca1850640e10d11fd1832447a to your computer and use it in GitHub Desktop.
Save thrasibule/3e498a1ca1850640e10d11fd1832447a to your computer and use it in GitHub Desktop.
$(function() {
$("#btn_plus").click(function() {
$(this).remove();
var t = document.getElementById("fragment").cloneNode(true),
labels = t.content.querySelectorAll("label");
for (var i = 0; i < labels.length; i++ ) {
labels[i].setAttribute("for", labels[i].getAttribute("for") + "-" + "2");
}
var clone = document.importNode(t.content, true);
document.getElementById("outgoing").appendChild(clone);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment