var i = 0;
var string = "Size: test ";
var speed = 50;
function printtext() {
if (i < string.length) {
document.getElementById("demo").innerHTML += string.charAt(i);
i++;
setTimeout(printtext, speed);
}
}
<button onclick="printtext()">Click me</button>
<div id="demo"></div>
I am trying to seperate "Size:" and "test". I would like "test" to be on the next line (under) so that when my button is clicked, it displays (like a typewriter) a list of information.
Conclusion: I'm just trying to find a way to go to the next line like some sort of \n.
Thank you,
Nathan