@w0s/form-before-unload-confirm
v2.0.1
Published
Prevent page unloaded while filling out a form
Downloads
6
Readme
Prevent page unloaded while filling out a form
Demo
Examples
<script type="importmap">
{
"imports": {
"@w0s/form-before-unload-confirm": "..."
}
}
</script>
<script type="module">
import FormBeforeUnloadConfirm from '@w0s/form-before-unload-confirm';
for (const formElement of document.querySelectorAll('.js-form-beforeunload-confirm')) {
new FormBeforeUnloadConfirm(formElement);
}
</script>
<form class="js-form-beforeunload-confirm">
<p><input /></p>
<p><button>Submit</button></p>
</form>
Constructor
new FormBeforeUnloadConfirm(
thisElement: HTMLFormElement
)