时间:2021-07-01 10:21:17 帮助过:4人阅读
$(document).ready(function () {
// validate the comment form when it is submitted
var myForm = $('form:first');
myForm.validate({
onkeyup: false,
success: function (element) {
var elem = $(element);
elem.poshytip('disable');
elem.poshytip('destroy');
},
errorPlacement: function (error, element) {
var elem = $(element);
if (!error.is(':empty')) {
//右:x=right;y=center
//左:x=left;y=center
//上:x=inner-left
//下:x=center;y=bottom
var aX = "center";
if (elem.attr("positionX") != null) {
aX = elem.attr("positionX");
}
var aY = "bottom";
if (elem.attr("positionY") != null) {
aY = elem.attr("positionY");
}
elem.filter(':not(.valid)').poshytip({
content: error,
alignTo: 'target',
alignX: aX,
alignY: aY,
offsetX: 0,
offsetY: 5
});
} else {
elem.poshytip('disable');
elem.poshytip('destroy');
}
}
});
});
存在问题
onkeyup不可以为 ture,因为这样,有些验证,气泡会一直存在。这个不科学。大家有什么好的办法没?