Giter Club home page Giter Club logo

form-validator's Introduction

form-validator

a lightweight pure javascript form validator

遵循ecmascript5,兼容IE9+,配合jQuery可以兼容IE6+。

##用法

  • 首先为需要添加验证规则的dom元素添加自定义属性rg-rule,属性值为**|**分隔开的规则名称。

  • 如果想设置错误提示可以添加**rg-msg-{ruleword}**属性,设置对应规则的提示语。rg-msg-all表示设置默认提示语,除已设置提示语的错误类型外都将使用此提示语。

  • 然后就可以在js里调用validator.Form方法new一个验证对象出来了。

    var valid = new validator.Form({ form:dom, //包含需要验证的一组dom元素的dom元素。可以是jQuery对象 target: dom, // }, alert);

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.