Configure your validation,
don't code it.
jQuery Form Validator keeps validation rules in your markup and out of your JavaScript.
Declare what a field needs with a data-validation attribute and the plugin
handles the rest — the checking, the messages, the styling, and the accessibility
plumbing that makes those messages reach everyone.
<form action="/signup" method="post">
<label for="name">Name</label>
<input id="name" name="name" data-validation="length" data-validation-length="min2">
<label for="email">Email</label>
<input id="email" name="email" type="email" data-validation="email">
<label for="site">Website</label>
<input id="site" name="site" data-validation="url" data-validation-optional="true">
<button type="submit">Create account</button>
</form>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/premento/[email protected]/dist/jquery.form-validator.js"></script>
<script>
$.validate();
</script>No rule objects, no schema, no per-field wiring. $.validate() finds every field carrying a data-validation attribute and takes over from there.
Why this plugin
Accessible by default
Errors are announced, not just coloured. aria-invalid, aria-describedby, polite live regions, and focus moved to the problem on submit.
50+ validators
Email, URL, dates, numbers and lengths built in. Credit cards, IBAN, passwords, files, colours and country-specific formats a module away.
Pay for what you load
The core is small and every extra family of validators is a separate module you opt into, by name or by import.
20 languages bundled
Whole-sentence message templates with real plural forms via Intl.PluralRules, not English word order with the number glued in.
Agrees with the browser
The native module mirrors every result onto the element, so checkValidity() and :user-invalid match your rules.
Modern packaging
UMD, ESM and TypeScript declarations. Works from a <script> tag, a bundler, or a plain import.
Built for real forms
Validation fires when a field loses focus, and once a field is showing an error it re-checks as the value changes — so a mistake is confirmed fixed the moment it is fixed, rather than on the next blur. That is the reward early, punish late pattern, and it is the default.
It listens to the input event, which means a value arriving by paste, autofill,
drag-and-drop, speech input or IME composition is caught. Key events miss all of those.
$.validate({
modules: 'security, date, file',
// Errors collected into one summary above the form instead of beside each field.
errorMessagePosition: 'top',
// Bootstrap 4/5 class names instead of the Bootstrap 3 era defaults.
bootstrap: 5,
onSuccess: function ($form) {
// Return false to submit over XHR instead.
return true;
}
});What is in 4.4.0
Version 3.0 was a substantial modernisation, and 4.x continues it. The headline changes:
- Accessibility. Every error is now associated with its field for assistive
technology, the summary is a navigable
role="alert", and focus moves to the problem. Read more → - Constraint Validation API. The
nativemodule keeps the browser's view of a field and the plugin's view in agreement. Read more → - Passwords rescored.
strengthfollows NIST SP 800-63B rev 4 — length-driven, not composition-driven — with optional breach screening. Read more → - Bootstrap 4 and 5 presets.
bootstrap: 5emitsis-invalidand.invalid-feedbackinstead of the 3.x class names. Read more → - ESM and TypeScript. An
exportsmap, real.d.tsdeclarations, and no runtime script injection. Read more →
Upgrading from 2.x? The upgrade guide lists every breaking change.
Where to next
Getting started
Install it, validate your first form, and learn how the pieces fit together.
Validator reference
Every rule, what it accepts, and the attributes that configure it.
Live examples
Working forms you can type into, running the real plugin on this page.
JavaScript API
Custom validators, events, and everything on $.formUtils.