By default, the validation prompt is displayed with a LABEL element, and CSS class is added, which makes it easy to set error controls and display the error messages by using CSS.
/* Input Control validation Error *
Form Input.error {border:solid 1px red;}
/* Validation error message * *
form label.error{width:200px;margin-left:10px; color:red;}
If you want to customize the display style, you can modify the default display for Jquery.validate
The default is to display the error message with the label, which can be modified by the Errorelement property
Errorelement: HTML tag for error messages
$ (". Selector"). Validate
Errorelement: "em"
})
You can wrap a layer of other elements in an error message.
Wrapper: The outer layer of the error message encapsulates the HTML tag
$ (". Selector"). Validate ({
Wrapper: "Li"
})
Validation error CSS Class default is error, through Errorclass can modify
Errorclass: CSS class used when validating an error
Also customize the actions when validation succeeds
Success: If the value is a string, it will be treated as a CSS class, and if it is a function, execute the function
Further, you can define a group, place the error information in a few places in one place, and use the error placement to control where to put the error message.
Groups: Define a group
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.