Bootstrap Changes button loading status _ javascript skills

Source: Internet
Author: User
This article mainly introduces how bootstrap changes the button loading status. If you need a friend, refer to the activation button in bootstrap and the button becomes unavailable;

According to the method described on the official website, add a data-loading-text = "Loading..." attribute to the button. Then the overall js Code is as follows:

The Code is as follows:



Loading state

Script
$ ('# MyButton'). on ('click', function (){
Var $ btn = $ (this). button ('loading ')
// Business logic...
$ Btn. button ('reset ')
})
Script

Specifically, the autocomplete = "off" attribute is for FF browsers. The disabled status will not be automatically removed after the page is loaded.
When I directly use the above code, I find that the loading status does not exist.
Then I changed it myself and wrote it like this, and it would be okay.

The Code is as follows:


Script
// Used for logging in with a smile and changing the loading status of the button for review
Function loag (){
Var btn = $ ("# btn_login ");
Btn. button ('loading ');
SetTimeout (function () {btn. button ('reset') ;}, 2000 );
}
Script
Login

After a few changes, we can achieve our requirements. I don't know if the official website is not tested. Here we recommend the solution to our friends.

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.