20 January 2020

How to get warning when exit browser without saving?

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>

No comments:

Post a Comment

How to add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...