html5 - how to fix ,Backspace is acting as page back in Chrome -
in dynamic web application backspace acting page in chrome , wanted block or @ least warn user leaving page, in case unintentional.
please me.
its possible duplicate of how can prevent backspace key navigating back?
// prevent backspace key navigating back. $(document).unbind('keydown').bind('keydown', function (event) { var doprevent = false; if (event.keycode === 8) { var d = event.srcelement || event.target; if ((d.tagname.touppercase() === 'input' && ( d.type.touppercase() === 'text' || d.type.touppercase() === 'password' || d.type.touppercase() === 'file' || d.type.touppercase() === 'search' || d.type.touppercase() === 'email' || d.type.touppercase() === 'number' || d.type.touppercase() === 'date' ) ) || d.tagname.touppercase() === 'textarea') { doprevent = d.readonly || d.disabled; } else { doprevent = true; } } if (doprevent) { event.preventdefault(); } });
Comments
Post a Comment