Loading state button in Bootstrap 3

前端 未结 1 943
南旧
南旧 2021-01-30 16:21

I\'m new to Bootstrap 3. Can\'t figure out how to activate the loading state button function. My code below is from the documents on getboostrap.com.

相关标签:
1条回答
  • 2021-01-30 16:55

    You need to detect the click from js side, your HTML remaining same. Note: this method is deprecated since v3.5.5 and removed in v4.

    $("button").click(function() {
        var $btn = $(this);
        $btn.button('loading');
        // simulating a timeout
        setTimeout(function () {
            $btn.button('reset');
        }, 1000);
    });
    

    Also, don't forget to load jQuery and Bootstrap js (based on jQuery) file in your page.

    JSFIDDLE

    Official Documentation

    0 讨论(0)
提交回复
热议问题