javascript - How to show unbeforeunload alert when form is filled? -
i want show "onbeforeunload alert" when tab closed when fill form , close tab "onbeforeunload alert" isn't appearing.
how can change code "onbeforeunload alert" can show when form filled? there's code use:
window.onbeforeunload = confirmexit; function confirmexit() { return "you exit system before freezing declaration! if leave , never return freeze declaration; not go effect , may lose tax deduction, sure want leave now?"; } $(function() { $("a").click(function() { window.onbeforeunload = null; }); $("input").click(function() { window.onbeforeunload = null; }); });
how can change code "
unbeforeunloadalert" can show when form filled?
you clicking <input /> filling form right? once click <input />, unbeforeunload set null (removing alert) following code:
$("input").click(function() { window.onbeforeunload = null; }); kindly remove code, , set. :) or can target submit button, more specifically:
$("input").click(function() { window.onbeforeunload = null; }); $("input[type='submit']").click(function() { window.onbeforeunload = confirmexit; });
Comments
Post a Comment