For my little project I want to have TextAreas and the textAreas should be generated in a for loop.
HTML
<h2>Settings for new Code:</h2>
<p>Amount of Checks:</p>
<input id="NumOfButtons"
name="NumOfButtons"
pattern=""
size="30"
spellcheck="false"
title="amount of Checks"
value="">
<script>
let input = document.getElementById("NumOfButtons");
input.addEventListener("keyup", function (event) {
let listTA;
if (event.keyCode === 13) {
event.preventDefault();
var x = parseInt(document.getElementById("NumOfButtons").value);
listTA = new Array(x);
for (let i = 0; i < x; ++i) {
var textarea = document.createElement("textarea");
textarea.name = "TextArea";
textarea.maxLength = "100";
listTA[i] = textarea;
input.appendChild(textarea);
}
}
});
</script>
The output should be a the amount of TextAreas which had been typed into the already existing textArea.