Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mboussaid/VerifyJS
https://github.com/mboussaid/VerifyJS
javascript js library regex verification
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mboussaid/VerifyJS
- Owner: mboussaid
- License: mit
- Created: 2021-02-10T11:41:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-10T11:41:42.000Z (almost 4 years ago)
- Last Synced: 2024-08-02T13:20:52.047Z (4 months ago)
- Topics: javascript, js, library, regex, verification
- Language: JavaScript
- Homepage: https://mboussaid.github.io/VerifyJS/
- Size: 45.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-morocco - VerifyJS - A minimal `javascript` library that allows to add verification to your inputs By [@mboussaid](https://github.com/mboussaid) (Uncategorized / Uncategorized)
README
# VerifyJS Documentation
this function allows you to add a keyup event handler and each time when you change the value this function checks if the value of the input match the regular expression if true then add your custom success classname else add your custom error classname
> syntax```javascript
verify(element,regExp,successClass , errorClass);
```
> examplecreate a success and error classNames
```css
.success{
backgroud:green;
color:#fff;
}
.error{
backgroud:red;
color:#fff;
}```
```html
```
```javascript
/// check if the length of the input is 8 at least
verify('#test-input',/^\w{8,}$/,'success','error');/// example for email
verify('#test-input',/^\w+@\w+.\w+$/,'success','error');/// example for phone number
verify('#test-input',/^(+2126|06)\d{8}$/,'success','error');/// example for url
verify('#test-input',/^(http:\/\/|https:\/\/)\w+.\w+\.\w+/,'success','error');```