feat: edit, lösch und done buttons hinzugefügt
Lösch button löscht den Eintrag Done button setzt checked auf true damit css darauf reagieren kann
This commit is contained in:
1 parent
ca0f7cda5d
commit
264781a815
1 file changed
+12
-1
+12
-1
@@ -20,7 +20,15 @@ function renderList() {
|
||||
listItems.forEach((element, index) => {
|
||||
const li = document.createElement("li");
|
||||
const removeButton = document.createElement("button");
|
||||
const editButton = document.createElement("button");
|
||||
const doneButton = document.createElement("input");
|
||||
|
||||
doneButton.setAttribute("type", "checkbox");
|
||||
doneButton.addEventListener("change", () => {
|
||||
listItems[index].done = doneButton.checked;
|
||||
});
|
||||
|
||||
editButton.textContent = "Bearbeiten"
|
||||
removeButton.textContent = "Löschen";
|
||||
removeButton.addEventListener("click", () => {
|
||||
listItems.splice(index, 1);
|
||||
@@ -28,7 +36,10 @@ function renderList() {
|
||||
});
|
||||
|
||||
li.textContent = element.name + " " + element.amount;
|
||||
li.appendChild(removeButton)
|
||||
li.appendChild(removeButton);
|
||||
li.appendChild(doneButton);
|
||||
li.appendChild(editButton);
|
||||
|
||||
|
||||
itemList.appendChild(li);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user