A few of participants close the survey by close web page, not submitted. I want to make a pop-ups message to ask them:"U've undone this survey. Are you sure you want to quit?" How to do that?
Many thanks
You can use the "beforeunload event, although the behaviour is not standardized across browsers.
Add something like this to the end of template.js:
Code:
$(document).ready(function(){
$(window).bind("beforeunload", function(event) {
return "Your data will not be saved!";
});
$('#movenextbtn, #movesubmitbtn').on('click', function () {
$(window).unbind("beforeunload");
});
});
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Thank for your response. But I still have a problem with pop-ups message. My survey is non-anonymous survey,so when I add this code to template.js, It's only appear on the register page (attached file). From welcome page to last page, It doesn't work. What can I do next?
Thanks in advance!