Warns before leaving a modified page.
npm install jquery-warn-before-unloadPrevents a page from unloading directly when something was changed in any input or text area. Asks whether you are sure or not.
Add with yarn or npm:
```
yarn add jquery-warn-before-unload
Then include javascript, for example like that (in a rails project):
``
//= require jquery-warn-before-unload/jquery.warnBeforeUnload
Any input / select field change triggers an alert if you try to leave the page without saving.
We consider that a form submission clears the alert.
Basically you have some code like that in your html:
``
If you change the text input and try to leave the page (by clicking any link or refresh on your browser) you will trigger the warning. If you just submit the form the warning will not be triggered.
Please note that inputs/selects with any of those classes: do-not-warn-before-unload, filter will be ignored and will not trigger the alert.search
Input type won't trigger the alert either.do-not-unlock` will not remove the alert.
Also note that a form with a class