我有一个小问题。我想为我的密码检查重新定位我的错误消息。我想在我的表单按钮下看到该消息。所以我尝试设置一个errorLabelContainer,但它没有用,任何人都可以帮我解决问题吗?
HTML:
<form name="f" id="f" action="<%= request.getContextPath() %>/setpassword" method="POST">
<table>
<tr>
<td>
<label for="password">Passwort</label>:
</td>
<td>
<input type="password" id="password" name="password" size="20" />
</td>
</tr>
<tr>
<td>
<label for="password_again">Passwort wiederholen</label>: </td>
<td>
<input class="left" type='password' id="password_again" name="password_again" size="20" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan='2' align="center">
<input name="submit" type="submit" value="submit" />
</td>
</tr>
</table>
<div class="errorMsg"> </div>
</form>
JQuery的:
$( "#f" ).validate({
rules: {
password: {
required: true,
minlength: 8
},
password_again: {
equalTo: "#password"
}
},
messages: {
password: {
required: "Bitte geben Sie Ihr Passwort zwei mal ein.",
minlength: "Ihr Passwort muss aus mindestens 8 Zeichen bestehen."
},
password_again: {
required: "Bitte geben Sie Ihr Passwort zwei mal ein.",
equalTo: "Ihre Eingabe muss gleich sein."
}
},
errorLabelContainer: '#errorMsg',
wrapper: 'li'
});
感谢您的帮助:)
答案 0 :(得分:2)
您的<div>
包含类 errorMsg
,但您正在搜索 id errorMsg
的元素。