I'm using the following js to show a popup before the browser/window closes. But it does not seem to be working.
$(window).bind('beforeunload', function(e) {
$('#beforeclose').click();
});
The popup i'm trying to show is prettyPopin . And the #beforeclose
is the id of the anchor with which i'm trying to bind the click event before the window unloads. I have noticed that native js popups work but the jQuery popup does not work.
Is there a way to achieve what i want to? Please do explain to me or refer me to the respective link because i'm not an expert at js.
Thanks in advance.