我在输入有效数据时遇到了这样的麻烦,没关系
但在那之后,当我输入错误数据时出现这种情况:
这是我的 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>