My path to Learning _ 28th _jquery and Validator Plugins

Source: Internet
Author: User
Tags jquery library

jquery uses jquery to traverse JS Primitives: for (Var i=0;i>?; i++) {}jquery: Method One: The jquery object that you want to traverse. each (function (index,dom) {}), mode two: $.each (the jquery object that you want to traverse, function (Index,dom) {}); Action element value or tag body xxx (): Gets the operation xxx ("value"): Set Gets or sets the value: Val (); Gets or sets the tag body: HTML () Gets or sets the label body: text () the difference between HTML and text is that the former resolves, and the latter does not insert: internal insert. Append () a.append (b) Inserts the latter into the back of the former prepend () A.prepend (b) Inserts the latter in front of the former AppendTo () a.appendto (b) inserting the former into the latter prependto () A.prependto (b) Insert the former outside of the latter: after () A.after (c) Add Cbefore () A.before (c) at the back of a to add the difference between the C inner insert and the outer insert in front of a: inner insert to insert elements inside an element Insert an element in a sibling element clear operation: Empty (); clear Remove (); Remove, suicide Select drop-down Select Box Properties: Multiple: Value multiple specifies that you can select size: Control the number of display items the Form object property filter Selector: Enabled: Disabled not available: checked (for radio checkbox): Selected drop-down select box "Validator Plugin" This plugin is written in jquery, Therefore, the introduction of plug-ins must also be introduced into the jquery use: 1. First introduce the jquery Library 2. Introduction of the Validator Library 3. After the page is loaded successfully, specify the form you want to verify by $ (function () {$ ("selector"). Validate (); 4.validator method using $ ("selector"). Validate ({rules:{}//Rule messages:{}//hint}) 5. Common rules Required:true|false (required) number:true| False (value type must be filled) min:5 (minimum: The number written must be greater than five) Max:5 (maximum: The number written cannot be greater than five) Range:[min,max] (interval: The number written can only beThis interval) maxlength:minlength:rangelength:equalTo: "selector" (Password and Confirm password, so the element must be the same as in the selector) digits: integer (write-only integer) Email:email (mailbox authentication) 6. The write format of the rule: $ ("selector"). Validate ({rules:{//writing format}messages:{}}) write format: mode one: The Name property name of the field you want to validate: "Rule name" way two: the Name property name of the field you want to verify: {"Rule 1" : Value, "Rule 2": Value}7. Custom error message writing format: Mode one: The Name property name of the field that you want to validate: "Prompt message" way two: the Name property of the field you want to verify: {"Rule 1": "Prompt information 1", "Rule 2": "Hint Information 2"}8. Validate Custom Rule $.validator.addmethod (name,fn,message); Name: rule name Fn:function (value,element,params) {value: User input value element: The element itself params: parameter}//must have a return value Booleanmessage: Default prompt information extended content filtering: Children (): Gets child element parent (): Gets parent element Find (): Get descendant elements next (): Big Brother Nextall (): All Brother Prev (): Little Brother Prevall (): All Brother siblings (): All Brothers is (): Determine whether the specified element

My Path to Learning _ 28th _jquery and Validator plugins

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.