I'm trying to create a to-do list and this code allows the user's "to-do" to be printed on the webpage, but it disappears when you stop clicking enter. Does anyone know what I'm doing wrong?
const addButton = document.querySelector(".button");
const inPut = document.querySelector(".inPut");
const space = document.querySelector(".toDo");
addButton.addEventListener("click", () => {
const entry = document.createElement("div");
const item = document.createElement("li");
item.innerText = inPut.value;
entry.append(item);
space.append(entry);
});