Okipa / laravel-table

Generate tables from Eloquent models.
MIT License
532 stars 64 forks source link

Example jQuery code for destroyConfirmationHtmlAttributes does not work #55

Closed PaulMcRoar closed 3 years ago

PaulMcRoar commented 3 years ago

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 3 years ago

Hi again @PaulMcRoar,

This has been fixed in https://github.com/Okipa/laravel-table/pull/57.

Thanks !