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>

更新于: 12-6-2020

2K+ 次浏览

开启你的 职业生涯

通过完成课程获得认证

开始
广告
© . All rights reserved.