I’m sure this is an easy thing but I’m struggling to build a custom cancel button on a popup. I need a custom cancel button because I need some other code to run when the window is cancelled.
Here’s my error:
cannot call methods on popup prior to initialization; attempted to call method 'close’
Here’s my code:
var requestlistpopup = $('#requestlistpopup').mobiscroll4().popup({
display: 'top',
responsive: {small: {display: 'center'}},
scrollLock: false,
buttons: [{text: 'Cancel',
handler: function (event) {
slide(0);
$('#requestlistpopup').popup('close');
}
}]
}).mobiscroll4('getInst');
The $(’#requestlistpopup’).popup(‘close’); part is giving me trouble. I’ve also tried.
$(this).close();
and
requestlistpopup.close();
Mobiscroll is not happy.