- The user loves "double clicking" on any button even though single click will trigger the action.
- The Internet connection slows down and the user thought that he did not click on the correct button. So, he decided to click it again even though the waiting time is lesser than 1 second (?!).
var _prev_save_click_ts = null;
function beforeSubmit() {
if (_prev_save_click_ts != null) {
var ts = new Date();
if (ts - _prev_save_click_ts < 500) {
// user is double clicking.
return false;
}
}
_prev_save_click_ts = new Date();
return true;
}
No comments:
Post a Comment