mercredi 12 août 2020

javascript --- get a new data everytime user press the button and cancel the previous one

everytime a user press the button I want to overwrite on the <h1> to whatever the user insert(in this case will always be a date), instead of keep adding child on the DOM, can someone help me? here's the code:

const header = document.createElement("h1");
header.classList.add("star-sign");
div.appendChild(header);

If ('statement'){header.innerHTML = 'execute'}

Aucun commentaire:

Enregistrer un commentaire