added a remove button issue#529

This commit is contained in:
mannam 2023-12-30 16:42:41 +05:30
parent 63eacf443e
commit bbd8de0899

View File

@ -21,6 +21,7 @@ function displayFiles(files) {
<div class="arrows d-flex">
<button class="btn btn-secondary move-up"><span>&uarr;</span></button>
<button class="btn btn-secondary move-down"><span>&darr;</span></button>
<button class="btn btn-danger remove-file"><span>&times;</span></button>
</div>
</div>
`;
@ -56,6 +57,16 @@ function attachMoveButtons() {
}
});
}
var removeButtons = document.querySelectorAll(".remove-file");
for (var i = 0; i < removeButtons.length; i++) {
removeButtons[i].addEventListener("click", function (event) {
event.preventDefault();
var parent = this.closest(".list-group-item");
parent.remove();
updateFiles();
});
}
}
document.getElementById("sortByNameBtn").addEventListener("click", function() {