Sometimes we need to send text messages to the user by clicking a button, you need a timing effect.
<button id = "msg" type = "button" style = "width: 120px; height: 30px"> Get text verification </ Button> <Script the src = "http://cdn.bootcss.com/jquery/1.11. . 3 / jquery.min.js "> </ Script> <Script type =" text / JavaScript "> var COUNT = 60, Timer = null; $ (" MSG # ") the Click (function (). { / * prevent users repeatedly clicking the button * / IF (Timer == null) { Timer = the setInterval (function () {COUNT -; $ ( "MSG #") text (COUNT + "Get codes after the second");.
IF (COUNT <= 0) {clearInterval (timer); $ ( "# msg") text ( " click for code");. Timer = null;}}, 1000); } }); </ Script>
display effect: