Home >Web Front-end >JS Tutorial >javascript form validation - Parsley.js usage and configuration_javascript skills

javascript form validation - Parsley.js usage and configuration_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:42:511838browse
Online Demonstration
Everyone still remembers the form validation jquery plug-in jquery.validationEngine that we introduced before. Using this plug-in, you can generate a function without writing a single line of js code. Powerful form validation capabilities. Isn’t it awesome? The Parsley introduced today can also help you implement form validation functions using only simple configuration, based on its powerful DOM-API.

Main Features
•Based on awesome user experience
•Super convenient to configure
•Super lightweight (12K after compression), supports jQuery and Zepto
•Super simple, just configure DOM-API, similar to jQuery’s data API
•Absolutely free
•Very reliable

Built-in validation
•required: input required
•Not blank: cannot be empty
•Min length: minimum length
•Max length: maximum length
•Range length: length interval
•Min: Minimum value
• Max: maximum value
• Range: range value
• RegExp: regular expression
• Equal To: equal to
• Min check: check the minimum number of selected checkboxes
•Max check: Check the maximum number of selected checkboxes
•Range check: Check the number of intervals of selected checkboxes
•Remote: ajax verification
Using and configuring Parsley.js is very simple, you just You need to use the data attribute of HTML to configure html, as follows:
Copy code The code is as follows:





< input type="text" id="email" name="email" data-trigger="change" data-required="true" data-type="email" />






Isn't it very convenient, and the documentation is very complete, but if you need to use Chinese, You need to localize it yourself. I believe friends who have used it will like it!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn