js method to prevent repeated clicks or too fast clicks
1.html
<button type="button" data-val="0">00000</button> <button type="button" data-val="1">11111</button> <button type="button" data-val="2">22222</button>
2.js
<script> var isClick = true; $("button").on("click",function(){ if(isClick) { isClick = false; //事件 console.log($(this).attr("data-val")); //定时器 setTimeout(function() { isClick = true; }, 1000);//一秒内不能重复点击 } }); </script>
For more related tutorials, please visit JavaScript Video Tutorial