Bootstrap输入表单验证

时间:2015-05-11 14:41:43

标签: javascript jquery html

我提交的表单只有一个无效输入,整个表格变成红色?

如果我更改了无效输入,则它不会变为绿色,而是保持红色。

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/signin.css" rel="stylesheet">
    
    <script src="js/jquery.js"></script>
    <script src="js/jqBootstrapValidation.js"></script>
    
    <script>
    $(function() {$("input,textarea,select").jqBootstrapValidation();});
    </script>

  </head>

  <body>
  
     <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
    <div class="container">

      <form class="form-signin" id="login" novalidate>
        <h3 class="form-signin-heading">Sign up</h3>
        <div class="control-group">
            <label for="inputEmail" class="control-label">Email address</label>
            <div class="controls">
                <input type="email" id="inputEmail" class="form-control"  required autofocus>
            </div>
        </div>
        <div class="control-group">
        <label for="inputPassword" class="control-label">Password</label>
        <div class="controls">
        <input type="password" id="inputPassword" class="form-control" required required data-validation-required-message="Password is empty">
         </div>
        </div>
        <button name="login" class="btn btn-lg btn-primary btn-block"  type="submit">Login</button>
         </form>
    </div> <!-- /container -->
  </body>
</html>

0 个答案:

没有答案