Bootstrap .has-error 類


使用 has-error 類可以為輸入設定錯誤。

你可以嘗試執行以下程式碼來實現 has-error 類

示例

實際演示

<!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>
      <form class = "form-horizontal" role = "form">
         <div class = "form-group has-error">
            <label class = "col-sm-2 control-label" for = "inputError">
               Input with error
            </label>
            <div class = "col-sm-10">
               <input type = "text" class = "form-control" id = "inputError">
            </div>
         </div>
      </form>
   </body>
</html>

更新於:2020-6-12

2 千次以上瀏覽

開啟你的職業生涯

完成課程認證,獲得證書

開始學習
廣告
© . All rights reserved.