天使漫步IT工作室

weui 验证码倒计时代码片段

weui验证码后倒计时代码片段如下,经测试有效!!!

//倒计时
                                    $('#btn_send_code').css("pointer-events","none");
                                    $('#btn_send_code').attr("disabled", true);
                                    var timeCount = 60;
                                    var timer = setInterval(function () {
                                        timeCount --;
                                        $('#btn_send_code').text(timeCount+"s 后重新获取");
                                        if (timeCount <= 0){
                                            $('#btn_send_code').css("pointer-events","all");
                                            $('#btn_send_code').attr("disabled", false);
                                            $('#btn_send_code').text("获取验证码");
                                            clearInterval(timer);
                                        }
                                    }, 1000);

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »