Quiz: Enter drücken
Ein Druck auf Enter im Feld sollte die Notiz zur Liste hinzufügen, aber nichts passiert. Klicke auf die Zeile mit dem Fehler.
1const notizInput = document.querySelector("#notiz");
2const notizListe = document.querySelector("#notizen");
3
4notizInput.addEventListener("keydown", function (event) {
5 if (event.key === "enter") {
6 const eintrag = document.createElement("li");
7 eintrag.textContent = notizInput.value;
8 notizListe.append(eintrag);
9 notizInput.value = "";
10 }
11});