如图怎样把错误提示放到时button后面去
输入框
可以通过errorPlacement来指定错误位置
errorPlacement: function(error, element) {
error.appendTo(element.parent().find("errorBox"));
}
比如在你输入框下边
我测试通过了,如果需要源代码,联系我
[code="javascript"]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
111
$().ready(function() { $("#signupForm").validate({ errorPlacement: function(error, element) { $('#error1').html(error); }, rules: { firstname: "required", email: { required: true, email: true }, password: { required: true, minlength: 5 }, confirm_password: { required: true, minlength: 5, equalTo: "#password" } }, messages: { firstname: "请输入姓名", email: { required: "请输入Email地址", email: "请输入正确的email地址" }, password: { required: "请输入密码", minlength: jQuery.format("密码不能小于{0}个字 符") }, confirm_password: { required: "请输入确认密码", minlength: "确认密码不能小于5个字符", equalTo: "两次输入密码不一致不一致" } } }); });
Firstname
E-Mail
Password
确认密码
[/code]