Parsley is a HTML form validation library in JavaScript.
There are some advantages of Parsley:
- No need to write JS code for simple form validation, it’s really easy.
- It automatically detects user modification in input form and adapts its validation.
In this post, we would like to share basic knowledge when we used it in work.
Parsley validates input like this:
<script src="jquery.js">script> |
If you want to see more detail, please see Deomo.
👽 Built-in validators
Parsley comes with many builtin validators and provides tools. Some of the validators are as follows:
Name | API | Description |
---|---|---|
Require |
data-parsley-required |
It validates that a field has filled with a non blank value |
Equalto |
data-parsley-equalto="#anotherfield" |
It validates that the value is identical to another field’s value(e.g. Password confirmation check) |
Have a look at Built-in validators | parsley for more validators.
🚕 Special Thanks
🖥 Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!