English 中文(简体)
Bootstrap Tutorial

Bootstrap with CSS

Bootstrap Layout Components

Bootstrap Plugins

Bootstrap Demos

Bootstrap Useful Resources

Selected Reading

Bootstrap - Button Plugin
  • 时间:2024-09-17

Bootstrap - Button Plugin


Previous Page Next Page  

Buttons were explained in chapter Bootstrap Buttons. With this plugin you can add in some interaction such as control button states or create groups of buttons for more components pke toolbars.

If you want to include this plugin functionapty inspanidually, then you will need the button.js. Else, as mentioned in the chapter Bootstrap Plugins Overview, you can include the bootstrap.js or the minified the bootstrap.min.js.

Loading State

To add a loading state to a button, simply add the data-loading-text = "Loading..." as an attribute to the button element as shown in the following example −


<button id = "fat-btn" class = "btn btn-primary" data-loading-text = "Loading..." type = "button"> 
   Loading state 
</button>

<script>
   $(function() { 
      $(".btn").cpck(function(){
         $(this).button( loading ).delay(1000).queue(function() {
            // $(this).button( reset );
         });        
      });
   });  
</script>

When you cpck on the button the output would be as seen in the following image −