我正在为文本框使用 jquery 插件.. 在我的其他文本框中,插件工作正常......但是当我为我的一些文本框提供详细信息时,jquery 不起作用..
这是我的代码:
jQuery("#Merchant_Registration").validate({
rules: {
UserN: "required",
pass: {
required: true,
minlength: 5
},
confirm: {
minlength: 5,
equalTo: "#Password",
},
question: "required",
answer: "required"
},
success: function () {
xval = true;
},
messages: {
UserN: "Please enter your last name",
pass: {
required: "Provide a password",
minlength: "Password length at least 5 characters!"
},
confirm: {
minlength: "Password length at least 5 characters!",
equalTo: "Enter the same password as above"
},
question: "Please enter a security question",
answer: "Please enter answer to security question"
}
});
if (jQuery("#Merchant_Registration").valid()) {
return true;
}
这是我的标记代码:
<p>
<label>Username:</label>
<span class="field">
<asp:TextBox ID="UserName" class="required" runat="server" name="UserN"></asp:TextBox>
</span>
</p>
<p>
<label>Password:</label>
<span class="field">
<asp:TextBox ID="Password" class="required" runat="server" name="pass"></asp:TextBox>
</span>
</p>
<p>
<label>Re-type Password:</label>
<span class="field">
<asp:TextBox ID="Password2" class="required" runat="server" name="confirm"></asp:TextBox>
</span>
</p>
<p>
<label>Security Question:</label>
<span class="field">
<asp:TextBox ID="SecurityQ" class="required" runat="server" name="question"></asp:TextBox>
</span>
</p>
<p>
<label>Security Answer:</label>
<span class="field">
<asp:TextBox ID="SecurityA" class="required" runat="server" name="answer"></asp:TextBox>
</span>
</p>
在我的密码字段中,它不检查用户输入是否相同......并且不显示消息..
而其他文本框,当单击下一步按钮时,显示的错误是“此字段是必需的”,而不是预设消息...
有人可以帮我吗..谢谢..