diff --git a/app/public/static/collection_editor.js b/app/public/static/collection_editor.js index ad1303b7..c5e66379 100644 --- a/app/public/static/collection_editor.js +++ b/app/public/static/collection_editor.js @@ -84,9 +84,12 @@ function addPackage(pkg) { `; - const newElement = temp.children[0]; - document.getElementById("package_list").appendChild(newElement); - newElement.scrollIntoView(); + const card = temp.children[0]; + document.getElementById("package_list").appendChild(card); + card.scrollIntoView(); + + const button = card.querySelector(".btn-danger"); + button.addEventListener("click", () => removePackage(card)); } diff --git a/app/templates/collections/create_edit.html b/app/templates/collections/create_edit.html index 355f94eb..4b43e56a 100644 --- a/app/templates/collections/create_edit.html +++ b/app/templates/collections/create_edit.html @@ -9,7 +9,7 @@ {% endblock %} {% block scriptextra %} - + {% endblock %} {% block content %}