Type:
1 2 3 ... 4 5 6 ... 7 8 9
And so on.
Example
var clic = 0;
function mais() {
if (clic == 1) {
document.getElementById('txt').textContent += "1 2 3 "
} else if (clic == 2) {
document.getElementById('txt').textContent += "4 5 6 "
} else if (clic == 3) {
document.getElementById('txt').textContent += "7 8 9 "
} else {
document.getElementById('btn').style.display = 'none';
}
}
<input type="button" value="mais" id="btn" onclick="mais(clic++)" />
<p id="txt"> </p>
In the above example, I set a limit for each click, it is not necessary to limit and can be unlimited for what I need.
So, I just want to always play 3 in 3 numbers, always get the last number and continue the sequence.
What I want to do is automate and improve the function without having to manually set the numbers and their order.