jQuery表单验证插件 Validation for Bootstrap
- 授权协议: Apache
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: http://fatesheep.github.com/Validation-for-Bootstrap/
- 软件文档: http://fatesheep.github.com/Validation-for-Bootstrap/
- 官方下载: https://github.com/FateSheep/Validation-for-Bootstrap
软件介绍
首先需要引入 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 的'-'之前为前面定义的验证规则名称。
The Creative Curve
Allen Gannett / Knopf Doubleday Publishing Group / 2018-6-12
Big data entrepreneur Allen Gannett overturns the mythology around creative genius, and reveals the science and secrets behind achieving breakout commercial success in any field. We have been s......一起来看看 《The Creative Curve》 这本书的介绍吧!
