I'm doing a notes webapp, I used DOM to add notes and remove, but when I remove it, it removes the first note and not the last one.
<script async>
function novaNota() {
var div = document.createElement("div");
div.id = "div";
div.style = "background-color: coral; padding: 10px; box-shadow: 3px 3px 3px silver; margin-left: 25px; margin-right: 25px;";
document.body.appendChild(div);
var input = document.createElement("input");
input.id = "input";
input.type = "checkbox";
input.style = "width: 25px; height: 25px; margin-left: 25%;";
div.appendChild(input);
var nome = prompt("Adicionar:");
var p = document.createElement(p);
p.textContent = nome;
p.style = "font-size: 20px; margin-left: 5%";
div.appendChild(p);
}
function removerNota() {
var div = document.getElementById("div");
document.body.removeChild(div);
}
</script>