Basically, I want to be able to add this code to the end of a parent div:
<br>
<div class="newPlayer">
<h3>Player ${playerCount}</h3>
<hr>
<p>Name:</p>
<input type="text" id="player${playerCount}"></input>
</div>
Here's what I'm currently using:
function newPlayer(){
playerCount++;
document.getElementById("players").innerHTML = document.getElementById("players").innerHTML + `<br><div class="newPlayer">
<h3>Player ${playerCount}</h3>
<hr>
<p>Name:</p>
<input type="text" id="player${playerCount}"></input>
</div>`
}
Which works, but it refreshes all the inputs which is annoying. Any better methods?