From d3bdc3d65e0e92ed93c5c874a5e834fe3e806b8b Mon Sep 17 00:00:00 2001 From: Tim Aldinger Date: Sat, 10 Oct 2026 11:51:54 +0200 Subject: [PATCH] =?UTF-8?q?.id=20zu=20dataset.id=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/models/ShoppingList.js | 2 +- src/main/resources/static/js/pages/index/index.js | 5 ++--- src/main/resources/templates/index.html | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/resources/static/js/models/ShoppingList.js b/src/main/resources/static/js/models/ShoppingList.js index 2a1d0b5..c4ae783 100644 --- a/src/main/resources/static/js/models/ShoppingList.js +++ b/src/main/resources/static/js/models/ShoppingList.js @@ -21,7 +21,7 @@ export class ShoppingList { const deleteButton = document.createElement("button"); li.classList.add("list"); - li.id = this.listID; + li.dataset.id = this.listID; a.setAttribute("href", `/list/${this.listID}`); a.classList.add("list__name"); diff --git a/src/main/resources/static/js/pages/index/index.js b/src/main/resources/static/js/pages/index/index.js index d21deac..7814242 100644 --- a/src/main/resources/static/js/pages/index/index.js +++ b/src/main/resources/static/js/pages/index/index.js @@ -12,9 +12,8 @@ async function addList(listName) { function editList(listLi) { //erstellen das Forms - //wir nutzen für das Element nur das div, weil sonst alle items mitgelöscht werden würden const formElement = ui.createEditListForm(listLi); - let id = listLi.id; + let id = listLi.dataset.id; listLi.replaceWith(formElement); @@ -43,7 +42,7 @@ function editList(listLi) { async function deleteList(listElement) { - const response = await api.deleteList(listElement.id); + const response = await api.deleteList(listElement.dataset.id); if (response.status == 204) ui.deleteList(listElement); } diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 0d03c15..ea487ca 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -32,7 +32,7 @@ xmlns:th="http://www.thymeleaf.org">