Skip to content

A simple little helper to show confirmation prompts for buttons and forms before submitting.

License

Notifications You must be signed in to change notification settings

philipnewcomer/confirm-submit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

confirm-submit

A simple little helper to show confirmation prompts for buttons and forms before submitting.

Installation

npm install --save-dev confirm-submit

Requirements

  • jQuery

Usage

require('confirm-submit');

...or simply load src/confirm-submit.js in your app.

Create a link, button, or form that requires user confirmation before submitting. Add a data attribute named confirm-submit, which contains the message that should be shown to the user in the alert.

<a href="http://domain.com" data-confirm-submit="Are you sure you want to leave?">
    Leave Site
</a>

You can use it in conjunction with a Javascript event listener on the click action:

<a onclick="javascript:alert('Launching missing now!')" data-confirm-submit="Are you sure you want to launch a missile?">
    Launch Missile
</a>

It even works when used directly on form tags:

<form data-confirm-submit="Are you sure you want to submit this form?">
    <input type="submit" value="Submit">
</form>

About

A simple little helper to show confirmation prompts for buttons and forms before submitting.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published