I have created a program where you can input a number, and it will count from 0 to the specified number. Currently, the numbers are aligned horizontally up to 12 before starting on a new line.
However, I would like the numbers to be arranged vertically from 0 to 9, followed by a new line next to the 0 for counting from 10 to 19, continuing until the specified value is reached.
function action() {
document.getElementById("container").innerHTML = "";
var highest = document.getElementById("numbers").value;
var count = 0;
for (var i = 0; i < highest; i++) {
document.getElementById("container").innerHTML += i + " ";
}
}
#container {
overflow: scroll;
height: 200px;
width: 200px;
}
<input type="number" id="numbers">
<br>
<input type="button" onclick="action()" value="Submit">
<div id="container"></div>