jquery_validation

How to use jQuery validation

HTML View

Basic init

Custom rules, messages

When defining rules, there’s quite a few different options available:

  • required – Makes the element required.
  • remote – Requests a resource to check the element for validity.
  • minlength – Makes the element require a given minimum length.
  • maxlength – Makes the element require a given maximum length.
  • rangelength – Makes the element require a given value range.
  • min – Makes the element require a given minimum.
  • max – Makes the element require a given maximum.
  • range – Makes the element require a given value range.
  • email – Makes the element require a valid email
  • url – Makes the element require a valid url
  • date – Makes the element require a date.
  • dateISO – Makes the element require an ISO date.
  • number – Makes the element require a decimal number.
  • digits – Makes the element require digits only.
  • creditcard – Makes the element require a credit card number.
  • equalTo – Requires the element to be the same as another one

Submit Handle and show custom error message

Custom Error Placement

 

jQuery validation plugin

Category: JavascriptJQueryPrograming
0
586 views

Join the discussion

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.