我有以下代码:
<form id="reg_form_pay" class="fancy_form" action="" method="POST">
<div class="wrap_input" style="margin-bottom: 10px;">
<p class="inp_label">Firstname:</p>
<i> </i>
<input id="pay_firstname" type="text" value="" name="FirstName" style="width: 157px;">
</div>
<div class="wrap_input" style="margin-bottom: 10px;">
<p class="inp_label">Surname:</p>
<i> </i>
<input id="pay_lastname" type="text" value="" name="Surname" style="width: 157px;">
</div>
<div class="wrap_input" style="margin-bottom: 10px; margin-top: 34px;">
<p class="inp_label">E-mail:</p>
<i> </i>
<input id="pay_email" type="text" value="" name="Email" style="width: 157px;">
</div>
<div class="wrap_input" style="margin-top: 34px;">
<p class="inp_label">Phone:</p>
<i> </i>
<input id="pay_phone" type="text" value="" name="PhoneNumber" style="width: 157px;">
</div>
</form>
和验证:
$("#reg_form_pay").validate({
rules: {
Email: { required: true, email: true, checkEmail: true },
PhoneNumber: { required: true, checkPhoneNumber: true },
FirstName: { required: true },
Surname: { required: true }
},
});
默认情况下,验证器label
在验证为假时写入。我不想添加带有错误描述的元素。我想用 class 将类添加error
到父div
级wrap_input
。我怎么能告诉验证者这样做呢?
谢谢。