js control button to prevent frequent clicking of response instances
- 2021-07-21 07:10:06
- OfStack
In order to prevent frequent clicking of buttons, you can adopt a strategy. After clicking once, let the buttons gray out, which can't be used temporarily, and can be used again after a period of time. The pseudo code is as follows:
var clicktag = 0;
$('.a_cc').click(function () {
if (clicktag == 0) {
clicktag = 1;
$(this).addClass("a_bb");
alert('click Triggered ');
setTimeout(function () { clicktag = 0 }, 5000);
}
});