Alibabacloud.com offers a wide variety of articles about form validation example in jquery, easily find your form validation example in jquery information here online.
This period of time to work more idle, the total feeling can not let their technology deserted, so again the old line, do a small demo to.
This time I made a JS version of the form verification plug-in, the overall principle of reference to the jquery validate, but in some small areas still have their own innovation.
The main features of this plugin are the following.
1.
This article is about PHP form validation corresponding to the Jquery-validate plug-in, has a certain reference value, now share to everyone, the need for friends can refer to
Direct code. If you do not understand the parameters, you can refer to the Jquery-validate plugin
Learning Recommendations:"THINKPHP5 Classic
Do project basically inseparable form verification, want to beautiful, concise, not account for memory, user experience effect is goodSo I recommend a JS form verification because I think this is very good, so share the nextThere are also downloaded compression packs under the documentationHttps://github.com/posabsolute/jQuery-
Objective
This problem after my collation found that the knowledge of the event and JS structure did not understand clearly, return false in the onclick event did not return, so onclick after just showing the false value.
Workaround Example
is a common form validation submission:
checkUserInfo()is a jquery
It's a good feeling to see the sharp jquery these days. Especially jquery's powerful selector. Use jquery today to write a small case of your own form verification. While consolidating the next jquery. First, the code, of course, is only a small case.Ideas:1, 2. var arrayinput = jQ
Verify the operation class formvalidatorclass. js
CopyCode The Code is as follows :/**
* @ Author Ming
*/
$ (Document). Ready (function (){
/** // * Set the default attribute */
$. Validator. setdefaults ({
Submithandler: function (form ){
Form. Submit ();
}
});
// Character Verification
Jquery. validator. addmethod ("stringcheck", function (value, element ){
Re
JqueryValidate plug-inVisit the jquery Validate website and download the latest version of the jquery Validate plugin.Examples of work:Add a validation rule$ (function () {$ ("#add_kcid"). focus ();$ ("#searchForm"). Validate ({Errorelement: ' Div ',Errorclass: ' Help-block ',Focusinvalid:true,rules:{add_kcid:{Required:true,},add_exam_number:{Required:true,},add_
Earlier I demonstrated the angular form validation example: Angularjs's Form validation example, in fact, we can use angular provided module messages for easier form
Key Features:
Validation of all data before form submission, non-conformance to commit (validate)
If the form check does not pass, auto focus to the first wrong domain
Automatically display error message after control
Support for checksum based on name and Class (Rule,addclassrules)
Remote check-in support (remotes)
Easy to scale: Easily custo
1, first need to import JS package and CSS Package: http://download.csdn.net/detail/l294333475/78169512. index.jsp (Test page)Validate.js: (Can be modified according to their own requirements)$ (document). Ready (function () {/** * acknowledgement information validation */jquery ("#checkInfoForm"). Validationengine ();/** * Custom Information validation *
1. Introduction of jquery Plugin (jquery dependent)
2. Define the validation rulesThe key is the name of the label$ (function () {$ ("#myform"). Validate ({rules:{"username": {"required": true, "Checkusername":true},3. Define error label StyleThe plugin automatically finds the first tag that matches the name= "xxx" and adds an error tag after it (c
One, download the dependency packageNET disk Download: Https://yunpan.cn/cryvgGGAQ3DSW access password f224Second, add a separate plugin jquery.validate.messages_cn. js.Change the default prompt mode.Third, jquery form validation plug-in----by the Name property to correlate fields to verify that Officer rules are written into the JS code. for= "Cusername" > Name
Easyui The validation box inside the form forms to explain the next Validatebox class and related properties.
Validation rules
Validation rules are defined by using the required and Validtype attributes, and here are the rules that have been implemented:
Email: matching email regular expression rules, system-provide
$ ("#commentForm"). Validate (): On it, what parameters should be added ...
Registration information authentication text message $ (function () {JQuery.validator.addMethod ("IsMobile", function (value, Element) {var length = Val
Ue.length; return this.optional (Element) | | (length = /^ ((13[0-9]{1}) | ( 15[0-9]{1}) | (18[0-9]{1}))
+\D{8}) $/.test (value)); "Please fill in your phone number correctly."
"); Entry into force $ ("#signup-form
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.