Last active
November 28, 2017 15:36
-
-
Save peterfication/675528043e4b45262a8ae454af4d7255 to your computer and use it in GitHub Desktop.
Rails SweetAlert confirm Webpacker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Rails from 'rails-ujs'; | |
const handleConfirm = () => { | |
// Do your thing | |
} | |
// Add event listener before the other Rails event listeners like the one | |
// for `method: :delete` | |
Rails.delegate(document, 'a[data-confirm-swal]', 'click', handleConfirm) | |
Rails.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment