English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
When sending the SMS verification code, the js time countdown problem needs to be solved: Sometimes this conventional writing method may cause js to fail, and many methods have been tried to find the problem, which may be due to the js version being too low.
setTimeout(showT(t-1),5000)
Solution:
setTimeout(function(){showT(t-1),1000)
or:
setTimeout("Talert(i)",5000);
jQuery code: It is necessary to use input to set the value in order to take advantage of jQuery to change the value
<<input type="button" id="sjyzm-btn" class="sjyzm-btn" value="Get Verification Code"/>
var t = 120; showT(t); function showT(t) { if(t > 0){ $(".sjyzm-btn").val(t +"seconds"); setTimeout(function(){showT(t-1),1000) //setTimeout(showT(t-1),5000) //$('.sjyzm-$("btn").attr("disabled",true); } $(".sjyzm-btn").val("SMS Verification"); //$(".sjyzm-$("btn").removeAttr("disabled"); } }
The solutions to the invalid time setting problems of JS introduced by the editor are as follows. Hope it will be helpful to everyone. If you have any questions, please leave a message, and the editor will reply to everyone in time. At the same time, I would also like to express my heartfelt thanks to everyone for supporting the Yell Tutorial website!
Statement: The content of this article is from the Internet, and the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously. This website does not own the copyright, does not undergo人工 editing, and does not assume relevant legal liabilities. If you find any content suspected of copyright infringement, please feel free to send an email to: notice#w.3If you find any copyright-infringing content, please send an email to: notice#w, replacing # with @ when sending emails, and provide relevant evidence. Once verified, this site will immediately delete the content suspected of infringement.