jquery - jConfirm and onbeforeunload -


I clicked the user, alerted to a browser back button (except for the submit button) or to alert a link On going, they will lose form data from the form wizard.

  & lt; Script type = "text / javascript" & gt; Var okToSubmit = false; Window.onbeforeunload = function () {document.getElementById ('Register'). Onclick = function () {okToSubmit = true; }; If using the "Backup (OkToSubmit)" browser back button you will lose all form data. Please use the next and backward buttons on the form "; }; & Lt; / Script & gt;  

I am using the jAlert plug for alerts and I want to use jConfirm for the above function. When I add jConfirm after the "return" Works for This warning pops up and then the page refreshes and the dialog box goes away. Does anyone know how to fix this?

I believe that you still need to return false; , otherwise the unload action still happens I'm not familiar with the plugin, but try something like this:

  // If your code (OkToSubmit) {alert (" You will lose all form data using the browser back button Please use the next and backward buttons on the form "); return false; } // Click the rest of the code  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -