Delete a book item from books page
You can also delete a book item from the book’s list on the book’s page. Here is the code you will need to achieve it. You need to create an event listener on the delete button with each book and remove the closest column.
// for delete an item
var
deleteItem
=
document
.
querySelectorAll
(
'.delete-item'
);
if
(
deleteItem
.
length
>
0
)
{
deleteItem
.
forEach
(
button
=>
{
button
.
addEventListener
(
'click'
,
function
()
{
button
.
closest
(
'.column'
).
remove
();
});
})
}