https://github.com/creative-workflow/jquery.input.validator
This jquery plugin helps to handle input validation based on standard html attributes.
https://github.com/creative-workflow/jquery.input.validator
Last synced: 9 months ago
JSON representation
This jquery plugin helps to handle input validation based on standard html attributes.
- Host: GitHub
- URL: https://github.com/creative-workflow/jquery.input.validator
- Owner: creative-workflow
- License: mit
- Created: 2018-03-29T18:17:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T22:15:49.000Z (over 3 years ago)
- Last Synced: 2025-08-26T13:24:32.723Z (9 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 1.36 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# jquery.input.validator [](https://travis-ci.org/creative-workflow/jquery.input.validator) [](https://coveralls.io/github/creative-workflow/jquery.input.validator) [](CONTRIBUTING.md) [](https://beerpay.io/creative-workflow/jquery.input.validator)
This [jquery](https://jquery.com) plugin helps to handle **html input validation** by applying rules to elements **based on html attributes**.
It is inspired by [jquery-validation](https://jqueryvalidation.org/) but has **less complexity**, **more comfort** and is easy adjustable for complex setups. Read more in the [Documentation](docs/DOCUMENTATION.md).
It has a high test coverage and is **tested with jquery >1.10, >2 and >3**
## Installation
```bash
bower install jquery.input.validator
# or
npm install jquery.input.validator
```
## Integration
Insert the following dependencies into your html file:
```html
```
## Examples
### Local pattern
```js
$('form').iValidator({
// custom configuration goes here
});
// validate all inputs in your form
var result = $('form').iValidator().validate();
if( result === true )
console.log('all inputs valid');
// reset error hints
$('form').iValidator().reset();
// validate element
$('form').iValidator().validateOne(
'<input type="email" value"invalid">'
);
```
### Gobal pattern
```js
var validator = $('body').iValidator({
// custom configuration goes here
});
// validate all inputs in your form
var result = validator.validate($('form'));
if( result === true )
console.log('all inputs valid');
// reset the error messages
validator.reset($('form'));
```
### Builtin validators
Validators are triggered from one or more attributes on an input element.
```js
var validator = $('body').iValidator();
// validators by input type
validator.validateOne('<input type="email" value"invalid">');
validator.validateOne('<input type="number" value"invalid">');
validator.validateOne('<input type="tel" value"invalid">');
// validators by html5 attributes
validator.validateOne('<input type="text" required>');
validator.validateOne('<input type="text" minlength="1" maxlength="3">');
validator.validateOne('<input type="text" pattern="^\\d*$">');
// validators by data attributes
validator.validateOne('<input type="text" data-rule-decimal="true">');
validator.validateOne('<input type="text" data-has-class="hello" class="hello">');
// add a custom message for an validator
validator.validateOne('<input type="text" required data-msg-required="required!">');
```
# Customize it all :hearts:
All implementation specific logic can be replaced via config (see [Documentation](docs/DOCUMENTATION.md)).
# Resources
* [Documentation](docs/DOCUMENTATION.md)
* [Changelog](docs/CHANGELOG.md)
* [Contributing](docs/CONTRIBUTING.md)
### Dependencies
* [jquery](https://jquery.com) >=1.10.0 (also tested with >=2, >=3)
### Services
* [on github.com](https://github.com/creative-workflow/jquery.input.validator)
* [on bower.io](http://bower.io/search/?q=jquery.input.validator)
* [on npmjs.org](https://www.npmjs.com/package/jquery.input.validator)
* [build status](https://travis-ci.org/creative-workflow/jquery.input.validator)
### Authors
[Tom Hanoldt](https://www.tomhanoldt.info)
## Support on Beerpay
Hey dude! Help me out for a couple of :beers:!
[](https://beerpay.io/creative-workflow/jquery.input.validator) [](https://beerpay.io/creative-workflow/jquery.input.validator?focus=wish)