jQuery表单验证插件 Validation for Bootstrap

码农软件 · 软件分类 · jQuery表单及相关 · 2019-12-23 13:59:38

软件介绍

首先需要引入 jQuery 和 Bootstrap 库,然后在Js代码中加入下面一行代码。

$('#form').validation();

$('#form') 为jQuery选中你需要验证的 dom 元素,最后只需要在html代码中指定相关的属性即可。

<form class="form-horizontal">
    <div class="control-group">
        <label class="control-label" for="inputEmail">邮箱</label>
        <div class="controls">
            <input type="text" id="inputEmail" check-type="mail" mail-message="邮箱格式不正确!" >
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputPassword">密码</label>
        <div class="controls">
            <input type="password" id="inputPassword" check-type="required" required-message="密码不能为空!" >
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <button type="submit" class="btn">登录</button>
        </div>
    </div>
</form>

其中 check-type 为需要验证的规则,可以绑定多个规则,之间用空格隔开。

其中 required-message 为验证为通过显示的信息,在这里 required-message 的'-'之前为前面定义的验证规则名称。

本文地址:https://codercto.com/soft/d/21780.html

Coding the Matrix

Coding the Matrix

Philip N. Klein / Newtonian Press / 2013-7-26 / $35.00

An engaging introduction to vectors and matrices and the algorithms that operate on them, intended for the student who knows how to program. Mathematical concepts and computational problems are motiva......一起来看看 《Coding the Matrix》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具