/confirmationDelete

jQuery confirmation delete code for Sweet Alert library

Primary LanguageJavaScriptMIT LicenseMIT

Confirmation Delete

To use this code you need to use jQuery and Sweet Alert libraries.

How the hell this code works? well, it's easy. Usually when we work with Bootstrap based templates, in our CRUDs we create buttons to delete our items, for bootstrap we have the class .btn-danger for that, this code detects every click in a button with .btn-danger class, and throws a Sweet Alert with a confirmation dialog, if you confirm the code will get the parent form and the request.

This way you don't need to use a lot of code, your re-use this code on your views.

# Tested in: Ruby+Ruby On Rails+jQuery