0
0
Fork 0
Weighted-RNG/js/add_choice.js
2019-09-10 01:00:05 -06:00

10 lines
No EOL
400 B
JavaScript

const add_choice = () => {
let index = document.getElementsByClassName("choice").length;
let choice_div = document.getElementById("choice-template");
let clone = choice_div.content.cloneNode(true);
clone.childNodes[1].childNodes[1].id = `text-in-${index}`;
clone.childNodes[1].childNodes[3].id = `weight-in-${index}`;
document.getElementById("choices").appendChild(clone);
}