当我输入有效数据时我遇到了麻烦
但在那之后,当我输入WRONG DATA时出现这种情况:
这是我的js代码,它与错误/有效类相关:
errorElement: "div",
wrapper: "div", // a wrapper around the error message
errorPlacement: function(error, element) {
element.before(error);
offset = element.offset();
error.css('right', offset.right);
},
success: "valid"
和CSS代码:
label.error{
color:#b76b6f;
width: 200px;
height: 60px;
text-align: right;
position: absolute;
margin-left: 280px;
margin-top: -20px;
margin-bottom: 0;
background: url('../images/not_valid.png') no-repeat;
background-position:100% 80%;
}
div.error{
color:#b76b6f;
width: 200px;
height: 60px;
position: absolute;
margin-left: 180px;
margin-top: -25px;
display: block;
background-color:#F3E6E6;
background: url('../images/not_valid.png') no-repeat;
background-position:100% 100%;
text-align: right;
}
在这种情况下生成HTML:
<div class="field2"><label for="user_password">Password</label>
<div class="valid"></div>
<div><div for="passworrd" generated="true" class="error" style="display: block;">Please enter at least 6 characters.</div></div>
<input type="password" size="30" name="user[password]" id="passworrd" class="passwords error"></div>
答案 0 :(得分:0)
我认为这是focusCleanup
选项的用途。
编辑:
尝试使用validClass: "valid"
代替success: "valid"
。