这是HTML代码的形式:
<form method="post" id="login" action="/login"> <div class="login-element"> <label for="email">E-Mail</label> <input type="text" name="email"> </div> <div class="login-element"> <label for="password">Passwort</label> <input type="password" name="password"> </div> <div class="login-element"> <input type="submit" value="Login"> </div> </form>
这里是我用于验证的代码:
$(document).ready(function() { $("#login").validate({ debug: true,rules: { email: { required: true,email: true },password: { required: true } },messages: { email: { required: "Please enter a email adress",email: "Please enter a valid email address" },password:"Please enter password" } }); });
在控制台中记录以下错误:
TypeError: validator is undefined ...or.settings[eventType] && validator.settings[eventType].call(validator,this[0],...
这里可能是什么问题?