I want to make a confirmation before user leaving the page if there's a incomplete registration or refresh the registration page
JQUERY CODE:
$(document).ready(function(){
$('input[name=subdomain]').keyup(subdomain_check);
$('input[name=password]').keyup(password_strenght);
$('input[name=c_password]').keyup(password_check);
$('input[name=email]').keyup(email_check);
$("#install").on('submit', function(){
return subdomain_check() && password_strenght() && password_check() && email_check();
});
window.onbeforeunload = function() {
return 'Are you sure you want to navigate away from this page?';
};
});
But the confirmation pop up in every step of the registration, even if the registration is complete! How can I prevent that from happening?