GithubHelp home page GithubHelp logo

stuartloxton / jvalidate Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 112 KB

A lightweight javascript validation system that stays out of the way and let's you control everything.

Home Page: http://stuartloxton.com/jvalidate/

jvalidate's Introduction

jValidate

jValidate allows for an easier and cleaner way of validating forms on the client side. It’s key features are that it puts validation rules in semantic HTML (inputs with class email are validates as emails, etc), is passive not aggressive, is easy to access and trigger.

There are several built in validation rules; email, url, number, string, ip, date. As well as general length restrictions with minimum length, max length and in a range. It’s also very simple to add your own validation rules, it’s easiest if you know regular expressions but it’s not a must.

There are several ways to check for validation:

  • With a function $('input').validate();
  • With selectors $('input:valid');
  • With listeners $('input').listenValidation();

h3.Use


<input class="email" name="email" type="text" />
<input type="text" name="username" rel="[5,15]" />

// JavaScript
$('form :invalid').each(function() {
    // $(this) is invalid
}
$('form input').each(function() {
    if($(this).isValid()) {
        // $(this) is valid
    }
}
$('form *').validateOnChange();

Examples

ToDo

  • Add more validation rules.
  • Support radio and checkbox validation.
  • Add a better listener.
  • Add more configurable actions and options.
  • Release.

jvalidate's People

Contributors

stuartloxton avatar

Stargazers

Angus H. avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.