jquery-modal
jquery-modal copied to clipboard
event.preventDefault() on BEFORE_CLOSE
Hi, @kylefox, Is it possible show confirmation screen/modal before closing the modal?
Hmm, there is the $.modal.BEFORE_CLOSE event that fires when the modal is about to close, but I don't believe it's possible to prevent the modal from closing at this point.
You'll probably need to manually bind to the elements & events that might cause the modal to close, i.e. the click event on the close icon and/or backdrop.
I ended up updating the modal code to fire custom event before closing the modal. Please check my code change. I'm pretty sure you can implement this in a far better way.
https://github.com/chandramuralis/jquery-modal/commit/cd28a4fc46b5bbb3aaa342ebd10ae42750682d92?diff=split