Magic Icon Changed Form Alert: Magic JavaScript

Quick Jump ↵

Alert the visitor when navigating away from a changed form

Usage

Add data-mjf="form_changed_alert" id="FORM_ID" to your <form> tag.

Add <script type="text/javascript">$m.wand.form_changed_alert = true;</script> inside your <body> tag.

Example

If you navigate away from this page after changing one of the fields below, you'll get an alert box letting you know that you haven't submited the form.





Radio Buttons



Checkboxes


Notes

This does not work in touch-based browsers and Opera 12 (the latest version as of this writing) or below - no support for OnBeforeUnload.

« Back to the main documentation