jQuery makes you smarter: Keep users from clicking on a link (or submitting a form) multiple times
There will be instances in which you need to limit user input for their own sake. Payment submission, file downloads, and…basically any time you require user input once and only once.
The script I’ve constructed here is meant to help reign in the wild masses by limiting clicks on links or form submissions.
This uses jQuery, so make sure you grab the latest version.
Usage
To use, just add the following classes based on the element the users are interacting with.
- Anchors* – add the class click-once to your link tag
- Forms – add the class submit-once to your form
Include jQuery and the script below, and you should be good to go. Short and sweet.
The JavaScript
Sample HTML
If you enjoyed this post, then tweet about it!