jquery: Verification Code Countdown

Source: Internet
Author: User

I was a little busy last week: So now it's up.

1. HTML

<div class= "center" >
<div class= "Member-code" > Send verification Code </div>
</div>

2. css

<style>

Color: White ;

Background-color: Green;

Width: 100px;

padding: 5px;

  Text-align: Center;

</style>

3.

<script>
$ (function () {
var i=0;
$ ('. Center '). On (' click ', '. Member-code ', function () {
if (i<1) {
i++;
$ ('. Member-code '). HTML ("No verification code received?"). <span class= ' Member-count-down ' >10</span> seconds after Resend ");

var Membercountdown = $ ('. Member-count-down '). html ();
var timer1 = setinterval (function () {
membercountdown--;
$ ('. Member-count-down '). HTML (Membercountdown);
if (membercountdown<=-1) {
i=0;
Clearinterval (timer1);
$ ('. Member-code '). HTML ("Get Verification Code");
}
},1000);

}
})
});
</script>

This is still flawed, is to refresh the page, next time to add.

jquery: Verification Code Countdown

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.