1

this below code is working correctly but i want alert of javascript one not windows alert.

unsaved = false;
            $(":input").change(function () { 
                unsaved = true;
            });

            $(document).on("submit", "form", function (event) {

                unsaved = false;
                $(window).off('unload');
            });           

            function unloadPage() {
                if (unsaved) { 
                    return "You have unsaved changes on this page. Do you want to leave page?";
                }
            }   
            window.onbeforeunload = unloadPage;
  • You can't use your own dialog to override the default one, This question has already been asked, and got a good answer [here][1]. [1]: http://stackoverflow.com/a/6065085/1592398 – Parth Trivedi Dec 23 '15 at 07:26
  • Sorry but this is not relevant to my need... Still it is not showing JS alert – Ajinkya Wavare Dec 23 '15 at 08:12

0 Answers0