我对表单验证有疑问。为什么这个例子不起作用?
HTML
<form action="" method="post">
<label>E-mail:</label>
<input type="text" name="email" placeholder="Email" />
<label>Password:</label>
<input type="password" name="password" placeholder="Password" />
<label>Repeat password:</label>
<input type="password" name="repeat" placeholder="Password repeat" />
<label></label>
<input type="submit" name="submit" class="button" value="Create" />
</form>
jQuery
$(document).ready(function() {
$('form').validate({
rules:
{
email: { required: true }
}
});
});