Home > Web Front-end > JS Tutorial > body text

jquery validate poshytip custom style_jquery

WBOY
Release: 2016-05-16 17:47:48
Original
1041 people have browsed it

Recently, I made a jquery.validate bubble prompt in my project.
It seems that the latest version of jquery.validate has this function, but it doesn’t work well for me.
I just added one myself.
I found some plug-ins qtip2 with good styles, but I can’t display them locally. He also has an example of jquery.validate. But the style is not displayed here. It seems to be the jquery version of asking him, and it can be displayed using his jquery. You can't cheat with mine. give up.
poshytip-1.1, the style is not bad!
positionX, positionY is the position where the prompt is displayed.

Copy code The code is as follows:

$(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')) {
//right: x=right;y=center
/ /Left: x=left;y=center
//Top: x=inner-left
//Bottom: 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');
}
}
});
});

There is a problem
onkeyup cannot be true, because in this case, some verification bubbles will always exist. This is unscientific. Does anyone have any good ideas?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!