Example jQuery code for destroyConfirmationHtmlAttributes does not work
PaulMcRoar opened this issue · 1 comments
PaulMcRoar commented
Hi,
The example jQuery code in the documentation for the destroy confirmation didn't work, not for me anyway. The message was always undefined.
What worked for me was using the jQuery 'on' method,
const destroyButton = $('form.destroy button[type="submit"]');
destroyButton.on('click', function(){
const message = $(this).data('confirm');
const form = $(this).closest('form');
if(confirm(message)) {
form.submit();
}
return false;
});
Hope this helps.
Okipa commented