I want to call a function before closing the bpopup. I have used following code:
$('#casepromptPopup').bPopup({
escClose: false,
closeClass: 'b-close',
modalClose: false,
onClose: function() {
confirm("Are you sure you wish to quit and grade your performance?");
I want to show the confirm message before popup close. But onClose method fires after the popup close.
While I'm not a fan of plugin modifications, it seems that there's no other way to achieve this.
Modify the bpopup.js:
1. Find
function close()and addif(o.confirmClose()){:2. Find
$.fn.bPopup.defaults = {(at the bottom) and add:Now you can add confirmation into your bpopup options:
JSFiddle