jQuery Form Validation — Working Code for 2026
Working jQuery form validation using the jquery-validate plugin — required fields, email format, password confirmation, custom rules. Complete code, common gotchas, and how to wire it to a free splitforms backend.
jQuery's `jquery-validate` plugin is the legacy-but-still-popular way to add rich client-side validation to a form. It's older than HTML5 native validation and predates React, but it still solves the validation-UI problem cleanly: declarative rules, custom messages, optional async submission. If your codebase already uses jQuery, validate is the path of least resistance.
The rules object maps field names to validation rules. Built-in rules: `required`, `email`, `url`, `number`, `digits`, `minlength`, `maxlength`, `min`, `max`, `equalTo`, `creditcard`. Each rule can be a boolean (apply the rule) or a value (apply with that parameter). The messages object pairs rule failures with user-facing strings.
The `submitHandler` is the function called when validation passes. By default it submits the form natively (full page reload). Override it to submit via AJAX — call `$.ajax({...})` with the form's serialized data, handle the response in your own UI, and skip the page reload. This is how you wire jquery-validate to a JSON API like splitforms.
Modern alternatives: HTML5 native validation (no library, less power), React Hook Form + Zod (typed, framework-coupled), Bootstrap 5 validation (native attributes + Bootstrap classes). For new projects, prefer one of these. For existing jQuery codebases, validate stays the right choice.
AJAX submission with jquery-validate's submitHandler
How to set this up
Include jQuery + jquery-validate
Two <script> tags from CDN. ~30KB combined.
Declare rules per field name
Map field names to rules (required, email, minlength, equalTo). Built-in rules cover ~90% of cases.
Override messages for UX
Default messages are generic. Per-rule message overrides give your form a polished feel.
(Optional) AJAX-submit via submitHandler
Override the default form submit to POST via $.ajax and update the DOM inline.
Declarative rules, custom messages, AJAX submit handler — all in 20 lines.
Frequently asked questions
What is jQuery form validation?
jQuery form validation typically refers to the jquery-validate plugin — a declarative client-side validation library that adds rules, custom messages, and async submission hooks to standard HTML forms. It predates HTML5 native validation but still ships clean APIs for complex validation scenarios.
Do I need jquery-validate for simple forms?
No. HTML5 native validation (required, type=email, pattern, minlength) handles simple cases without a library. Use jquery-validate when you need cross-field validation (password confirmation), custom rules, or rich error UI.
How do I add a custom validation rule in jQuery?
Use `$.validator.addMethod(name, function, message)` to register a custom rule. Example: `$.validator.addMethod("phoneUS", function (value) { return /^\(\d{3}\)\s\d{3}-\d{4}$/.test(value); }, "Phone must be (xxx) xxx-xxxx")`. Reference the rule by name in your rules object.
How do I validate a form on submit using jQuery?
Call `$(form).validate({rules, messages})` once at page load — jquery-validate hooks into the form's submit event automatically. When the user clicks submit, validation runs; if rules pass, the form submits; if they fail, errors render inline.
How do I submit a form via AJAX with jquery-validate?
Pass a `submitHandler` function in the validate config. Inside submitHandler, call $.ajax with the form's serialized data and handle the response in your own UI. This bypasses the default page-reload form submission.
Where do I get the jquery-validate CDN URL?
https://cdn.jsdelivr.net/npm/jquery-validation@1.19.5/dist/jquery.validate.min.js — pin to a specific version for reproducibility. Pair with jQuery: https://code.jquery.com/jquery-3.7.1.min.js.
Related guides
Ship the form, not the backend.
Free for 1,000 submissions/month. Email delivery, AI spam filtering, signed webhooks, real dashboard — all on the free plan. No credit card.
Get a free access key →