28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
const addStringButton = document.getElementById("add-string-button");
|
|
addStringButton.addEventListener("click", (e) => {
|
|
const stringName = prompt("Enter a string name: ");
|
|
if (stringName == "") {
|
|
return;
|
|
}
|
|
for (let section of document.getElementsByClassName("translation-section")) {
|
|
// const lang = section.getAttribute("data-lang");
|
|
// <label for="{{ string }}">{{ string }}</label>
|
|
// <input type="text" id="{{ string }}" name="{{ string }}" value="{{ translation }}">
|
|
// <br>
|
|
const label = document.createElement("label");
|
|
label.setAttribute("for", stringName);
|
|
label.innerText = stringName;
|
|
|
|
const input = document.createElement("input");
|
|
input.setAttribute("type", "text");
|
|
input.setAttribute("id", stringName);
|
|
input.setAttribute("name", stringName);
|
|
input.setAttribute("value", "");
|
|
|
|
const br = document.createElement("br");
|
|
|
|
section.appendChild(label);
|
|
section.appendChild(input);
|
|
section.appendChild(br);
|
|
}
|
|
}); |