Get warning when exit browser without saving
My website is www.wpcodekit.com
<script>
jQuery(document).ready(function($){
$(window).unbind('beforeunload');
$("input[type='submit']").click(function(){
$(window).unbind('beforeunload');
});
$("input").on("change paste keyup", function() {
$(window).bind('beforeunload', function(){
return 'Are you sure you want to leave?';
});
});
var contenteditable = document.querySelector('[contenteditable]'),
text = contenteditable.textContent;
$(contenteditable).each(function(){
$(this).on("change paste keyup", function() {
$(window).bind('beforeunload', function(){
return 'Are you sure you want to leave?';
});
});
});
$("input[type='submit']").click(function(){
$(window).unbind('beforeunload');
});
});
</script>
Comments
Post a Comment