.id zu dataset.id geändert

This commit is contained in:
Technoir committed 2026-10-10 11:55:15 +02:00
1 parent 13e2af55a8
commit d3bdc3d65e
3 files changed
+4 -5

No files matched your search

@@ -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");
@@ -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);
}
+1 -1
View File
@@ -32,7 +32,7 @@ xmlns:th="http://www.thymeleaf.org">
</form>
<ul class="displayedList">
<li th:each="list : ${lists}" class="list" th:id="${list.id}">
<li th:each="list : ${lists}" class="list" th:data-id="${list.id}">
<a class="list__name" th:text="${list.listName}" th:href="@{/list/{id}(id=${list.id})}"></a>
<button type="button" class="list__editButton">Liste bearbeiten</button>
<button type="button" class="list__deleteButton">Liste löschen</button>