我想在.valid
返回true
时提交表单。它适用于login_form
,但它会为true
返回signup_form
。 .validate
方法可以正常使用,但是当表单未经过验证时,.valid
会为true
返回signup_form
。
var login_form = $( "#login_form" );
var signup_form = $( "#signup_form" );
login_form.validate();
signup_form.validate({
rules:
{
signup_repeat_password:
{
equalTo:"#signup_password"
}
},
messages:
{
signup_repeat_password:
{
equalTo:"Please repeat the password"
}
}
});
if ( login_form.valid())
{
login_form.submit(
function()
{
alert("Please submit login_form");
}
);
}
if ( signup_form.valid())
{
signup_form.submit(
function()
{
alert("Please submit signup_form");
}
);
}