JavaScript
Article

10 jQuery Form Validation Plugins

By Julian Motz

This popular article was updated on 8th August, 2016 to reflect the current state of form validation plugins. Comments pertaining to the old article were deleted.

HTML5 introduced new form attributes so that the browser could validate forms natively. With CSS3 and JavaScript you can realize a basic form validation without the need of a plugin – as described in this article. But this has a few restrictions:

  • Error messages are left to the browser itself, you can only provide titles of input fields
  • You aren’t able to customize the styling of error messages
  • You’ll have to create patterns for input fields yourself

The following 10 jQuery form validation plugins set themselves the goal of customizing error messages and styling, as well as simplifying the creation of validation rules.

1. Parsley

An extensible plugin that offers ordinary options like localization and custom validation rules, but also a remote Ajax validation. The documentation is clean and easy to read and the project is actively maintained. Validation rules can be controlled using HTML5 form or custom data attributes.

See the Pen Parsley Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

2. jQuery Form Validator

A modular plugin, that offers a basic set of validation rules by default and lets you load further modules on demand. For example: a file validator when uploading files, but also date, security or location modules. It also allows you to provide input suggestions. The validation is controlled with HTML5 data attributes.

See the Pen jQuery Form Validator Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

3. jQuery Validation Plugin

One of the first validation plugins from 2006. It lets you specify custom validation rules using HTML5 attributes or JavaScript objects. It also has a lot of default rules implemented and offers an API to easily create rules yourself. Finding detailed information about the plugin may be hard at first and it’s limited to jQuery 1.x, but they promised to make it better – see this campaign.

See the Pen jQuery Validation Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

4. Bootstrap Validator

A jQuery validation plugin for Bootstrap. It’s basically just a wrapper around native form validation using HTML5 attributes, but can also be used to add custom rules. It always shows error messages from the browser, automatically translated into the correct language.

See the Pen Bootstrap Validator Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

5. Smoke

Smoke is a collection of components for Bootstrap – including a form validator. In comparison to the other Bootstrap validator (#4), it doesn’t use native browser validation – therefore error messages aren’t automatically localized and validation rules have to be specified using HTML5 and data attributes, as well as JavaScript.

See the Pen Smoke Form Validation Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

6. FormValidation

A premium jQuery validation plugin from 50$ with built-in integrations for Bootstrap, Foundation and others. It has a huge amount of validation rules as well as options and could be profitable for applications with many complex forms.

FormValidation

Website

7. Validatr

A very basic wrapper for form validation by the browser that uses native error messages wherever possible, controlled with HTML5 form attributes. It can be used as polyfill or to customize error message styling. Nothing more, nothing less.

See the Pen Validatr Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

8. Validetta

This plugin offers validation using a data attribute, with quite limited options. It comes with just the basic validation rules, everything else can be added with custom regular expressions – but there is no example demonstrating it. Compared to the other plugins, the only unique feature is that error messages are displayed in a bubble (see demo below).

See the Pen Validetta Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

9. jQuery.validity

A plugin to control validation with JavaScript only – no HTML5 or data attributes. While this may be helpful for dynamic validation rules, the plugin doesn’t offer enough options to make writing efficient. It even doesn’t allow using new HTML5 type attributes like email, nor does it provide a function to check if a form is valid – necessary in order to show a success message.

See the Pen jQuery.validity Plugin Demo by SitePoint (@SitePoint) on CodePen.

Website
Source code

10. h5Validate

This plugin has unfortunately been abandoned by its creator (Eric Elliott). Consequently, the demo/documentation website returns a 404 and there are two dozen open issues. The plugin doesn’t automatically validate inputs by type and the following example even doesn’t show error messages. We’ve included it in the list, as Eric is looking for a new maintainer for the project, so there’s a chance that at some point in the future, it might get some life breathed back into it.

See the Pen h5Validate Plugin Demo by SitePoint (@SitePoint) on CodePen.

Source code

Conclusion

Well, that’s the top ten list of popular jQuery form validation plugins. If you’ve had any experience with these (good or bad!), or if you know of other form validation plugins worth mentioning, please let us know in the comments!

Meet the author
Julian is a software developer and media designer, currently living in Berlin, Germany. He focuses on web and hybrid applications and loves open source development.

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.