Bootstrap - could anyone give me any example, how to set up JS buttons?

后端 未结 3 904
太阳男子
太阳男子 2021-02-05 07:24

I am playing with Bootstrap\'s stateful buttons - specifically with Loading state, but still can\'t find the right set up to get it working. I have a simple for

3条回答
  •  故里飘歌
    2021-02-05 07:45

    You need to explicitly set that the button is in the loading state. Something like this:

    // Set up the buttons
    $(button).button();    
    $(button).click(function() {
        $(this).button('loading');
        // Then whatever you actually want to do i.e. submit form
        // After that has finished, reset the button state using
        // $(this).button('reset');
    }
    

    I've created a working JSFiddle example.

提交回复
热议问题