civem
v0.0.71
Published
Custom Input Validation Error Messages
Downloads
3
Readme
Custom Input Validation Error Messages
HTML5 form validation error messages are hard-coded to the browser. Civem.js lets you easily change them to whatever you wish. For translation or consistency with your server-side error messages. Civem.js does not depend on any library or framework, so you can use it without a doubt.
Quick Start
- Grab the latest download
- Add the civem.js script to your page
- Start using the custom error message attributes on your
input
,textarea
andselect
elements
API
Any input
, textarea
or select
element may contain:
data-errormessage
a generic error message
Validity state specific error messages:
data-errormessage-value-missing
data-errormessage-type-mismatch
data-errormessage-pattern-mismatch
data-errormessage-too-long
data-errormessage-range-underflow
data-errormessage-range-overflow
data-errormessage-step-mismatch
data-errormessage-custom-error
Demo
At jsFiddle.
Tested on
- Firefox 17.0.1
- Chrome 23.0.1271.97