如何使用 Bootstrap 按鈕外掛


使用外掛新增一些互動功能,如控制元件按鈕狀態或為更多元件(例如帶工具欄的控制元件)建立按鈕組。

你可以嘗試執行以下程式碼來實現按鈕外掛−

示例

實際演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <h4>Button Example</h4>
      <div id = "myButtons2" class = "bs-example">
         <button type = "button" class = "btn btn-primary" data-loading-text = "Loading...">
            Primary
         </button>
      </div>
      <script type = "text/javascript">
         $(function () {
            $("#myButtons1 .btn").click(function(){
               $(this).button('toggle');
            });
         });
      </script>
   </body>
</html>

更新時間: 15-6 月-2020

90 個瀏覽

開啟你的 職業生涯

完成課程認證

開始吧
廣告