Plugin đang sử dụng vị trí tuyệt đối cho các thông báo lỗi.
Nếu bạn đang thêm các phần tử DOM khác di chuyển vị trí trường nhập tương ứng với tài liệu, thì bạn sẽ cần đặt lại thủ công tất cả xác thực < của div > sau khi tập lệnh của bạn sửa đổi DOM chạy.
Bạn có thể thử sử dụng phương thức bù đắp jQuery() http://api.jquery.com/offset/ để lấy vị trí mới của phần tử đầu vào tương ứng với tài liệu và sau đó tinh chỉnh thuộc tính trên cùng và bên trái của < của div >.
Đây là một .jsFiddle hiển thị cho bạn những gì tôi có nghĩa là: http://jsfiddle.net/ysQCf/2/
css
.errorMessage
{
background-color: red;
position: absolute;
left: 180px;
top: 25px;
}
p
{
display: none;
}
html
<p id="hidden">if you display this the textbox will move down</p>
<input id="myInput" type="text" />
<div class="errorMessage">stick me to the div</div>
<br />
<input id="show" type="button" value="Show" />
javascript
$(function() {
$("#show").click(function() {
// Save the offset of the error against the input
var offset = $(".errorMessage").offset();
offset.left -= $("#myInput").offset().left;
offset.top -= $("#myInput").offset().top;
// Call your script to manipulate the DOM
$("#hidden").show();
// Move the error div to it's new position
offset.left += $("#myInput").offset().left;
offset.top += $("#myInput").offset().top;
$(".errorMessage").offset(offset)
});
});