javascript - beforeunload event and JQuery Dialog immediately closes after switch screen -


good day,
here structure of .php

main.php

 of navibar here.  there's iframe screen contents. 

content1.php

 content 1 contains textfields.  jquery dialog if leaving screens. 

content1 code :

 $(window).bind('beforeunload', function(e){       dialog();  }); 

dialog();

 $('form[name="rowform"]').on('submit', function (e) {          e.preventdefault();      });       var fieldnamestocheck = xxxxx;      var previousvaluefieldnames = xxxxx;       if (detectchangesoninputs(fieldnamestocheck, previousvaluefieldnames)) {         $("#unsaved-values-confirmation-dialog").dialog("open");         $('.ui-dialog :button').blur();     } 

for close , refresh event, beforeunload event fine. when start hitting navibar, happen is, dialog shows , closes.

is there wrong in codes? thanks!


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -