javascript - How to unbind onbeforeunload event from all elements of the html body -
how unbind beforeunload event elements of html body. kindly tell me , there way unbind beforeunload event every javascript function call . please me , stuck badly on this.
i using below code :
var j$ = jquery.noconflict(); j$(document).ready(function() { jquery(window).bind("onbeforeunload", function() { return confirm("do want exit?", "true"); }); jquery('a').on('click', function() { jquery(window).unbind('onbeforeunload') }); jquery(window).bind('keydown keyup', function(e) { if (e.which === 116) { jquery(window).unbind('onbeforeunload'); } if (e.which === 82 && e.ctrlkey) { jquery(window).unbind('onbeforeunload'); } }); jquery(window).mousedown(function(e) { if (e.button == 2) { jquery(window).unbind('onbeforeunload'); } else { jquery(window).bind('onbeforeunload'); } }); jquery("form").submit(function() { jquery(window).unbind('onbeforeunload') }); jquery(document.body).unbind('onbeforeunload'); });
Comments
Post a Comment