Delete a customer from customer page
To delete a customer from the customer list on the customer’s page you can use the code below. You have to add an event listener on the delete button, and remove the closest row.
//for deleting a customer
var
deleteUserButton
=
document
.
querySelectorAll
(
'.delete-user'
);
if
(
deleteUserButton
.
length
>
0
)
{
deleteUserButton
.
forEach
(
button
=>
{
button
.
addEventListener
(
'click'
,
function
()
{
button
.
closest
(
'tr'
).
remove
();
});
});
}