Skip to content

Instantly share code, notes, and snippets.

@collinticer
Last active February 15, 2018 06:28
Show Gist options
  • Save collinticer/afb312844af633b10ccaccc899259f26 to your computer and use it in GitHub Desktop.
Save collinticer/afb312844af633b10ccaccc899259f26 to your computer and use it in GitHub Desktop.
@collinticer
Copy link
Author

collinticer commented Feb 15, 2018

This snippet creates links that require a confirmation click before proceeding. Useful to help prevent accidental deletes without requiring an entire view or modal dialog to confirm the action as shown below. The links href will only be redirected to only after confirmation click.

imageimage

This works well since it can fail gracefully in noscript scenarios. The user simply wont get the confirmation behavior, but the default href of the link will of course be called.

Also if the confirmation is never clicked, then after 5 seconds it reverts back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment