Giter Club home page Giter Club logo

h5validation's Introduction

遵循h5规范,使用简洁

概述

只需简单的按照h5 的属性写法即可实现验证,不需要写再多的js脚本了

使用

需要引入 jquery或者zepto 在页面中引入script/h5validate.js即可. 例如:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
        <title>h5validate</title>
        <script src="script/zepto.js"></script>
        <script src="script/h5validate.js"></script>
    </head>
    <body>
    
    </body>
</html>
   <table style="width: 100%;">
                <tr>
                    <td class="title">email:</td>
                    <td>
                        <input type="email" required  />
                    </td>
                </tr>
                <tr>
                    <td class="title">email:</td>
                    <td>
                        <select  name="HouseName" required>
                            <option value="">请选择</option>
                            <option>北京</option>
                            <option>深圳</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="title">mobile:</td>
                    <td>
                        <input type="mobile" />
                    </td>
                </tr>
                <tr>
                    <td class="title">number:</td>
                    <td>
                        <input type="number" />
                    </td>
                </tr>
				 <tr>
                    <td class="title">密码:</td>
                    <td><input type="password" id="pass" required /></td>
                </tr>
                <tr>
                    <td class="title">密码确认:</td>
                    <td><input type="password" equalto="#pass" required /></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" onclick="return $.h5validate.validate('#ftype')" value="验证" />
                    </td>
                </tr>
            </table>

演示

License

The MIT License(http://opensource.org/licenses/MIT) 请自由地享受和参与开源

贡献

如果你有好的意见或建议,欢迎提issue或pull request。

h5validation's People

Contributors

qingdie 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.