Recently, a jquery. validate bubble prompt is provided in the project.
It seems that this function is available in jquery. validate of the latest version, but it is not easy to use here.
Add one on your own.
I found some plug-ins with good qtip2 styles, but I cannot display them locally. He also has examples of jquery. validate. However, the style is not displayed here. It seems that the jquery version can be used for display. You can't use mine. Give up.
Poshytip-1.1 this, style is good!
PositionX and positionY are the locations where the prompt is displayed.
Copy codeThe 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 ('deststroy ');
},
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 ('deststroy ');
}
}
});
});
Problems
Onkeyup cannot be thought of as true, because in this way, some validation, bubbles will always exist. This is unscientific. Do you have any good solutions?