JQuery Validate input is dynamically changing

Source: Internet
Author: User

Form validation

class= ' Required number ' class= ' required number ' />  <br/><span></span></div> '  );  

  

When input is dynamic, you can use class= ' required ', but messages is still in English, if you want to change the content of messages, you can add it in the JS code:

Jquery.extend (jQuery.validator.messages, {    required: "Required field", Remote: "Please fix this field", Email: "Please enter the correct format of e-mail", url: " Please enter a valid URL ", Date:" Please enter a valid date ", Dateiso:" Please enter a valid date (ISO). ", Number:" Please enter a valid digit ", digits:" Enter only Integer ", CreditCard:" Please enter a valid credit card number ", Equalto: "Please enter the same value again", Accept: "Please enter a string with a valid suffix name", Maxlength:jQuery.validator.format ("Enter a string of up to {0}"), MinLength: JQuery.validator.format ("Please enter a string with a minimum length of {0}"), Rangelength:jQuery.validator.format ("Enter a string between {0} and {1}"), Range:jQuery.validator.format ("Please enter a value between {0} and {1}"), Max:jQuery.validator.format ("Enter a value up to {0}"), min: JQuery.validator.format ("Please enter a value of minimum {0}")});

Recommended practice, put this file into messages_cn.js and introduce it in the page:

<script src= ". /js/messages_cn.js "type=" Text/javascript "></script>

This allows you to change the error message you want in messages_cn.js.

JQuery Validate input is dynamically changing

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.