BootstrapValidator demo
source:http://bv.doc.javake.cn/api/
BootstrapValidator is the best jQuery plugin to validate form fields, designed to use with Bootstrap 3.
<link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
<!-- Include the FontAwesome CSS if you want to use feedback icons provided by FontAwesome -->
<!--<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" />-->
<script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
-
<form id="tryitForm" class="form-horizontal">
<div class="form-group">
<label class="col-md-3 control-label">Full name</label>
<div class="col-md-4">
<input type="text" class="form-control" name="firstName" />
</div>
<div class="col-md-4">
<input type="text" class="form-control" name="lastName" />
</div>
</div> <div class="form-group">
<label class="col-md-3 control-label">Email address</label>
<div class="col-md-6">
<input type="text" class="form-control" name="email" />
</div>
</div> <div class="form-group">
<label class="col-md-3 control-label">Gender</label>
<div class="col-md-6">
<div class="radio">
<label><input type="radio" name="gender" value="male" /> Male</label>
</div>
<div class="radio">
<label><input type="radio" name="gender" value="female" /> Female</label>
</div>
<div class="radio">
<label><input type="radio" name="gender" value="other" /> Other</label>
</div>
</div>
</div> <div class="form-group">
<div class="col-md-offset-3 col-md-8">
<button type="submit" class="btn btn-primary">Say hello</button>
</div>
</div>
</form> - JS
<script>
$(document).ready(function() {
$('#tryitForm').bootstrapValidator({
fields: {
firstName: {
validators: {
notEmpty: {
message: 'The first name is required and cannot be empty'
}
}
},
lastName: {
validators: {
notEmpty: {
message: 'The last name is required and cannot be empty'
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email address is required'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
},
gender: {
validators: {
notEmpty: {
message: 'The gender is required'
}
}
}
},
submitHandler: function(validator, form, submitButton) {
var fullName = [validator.getFieldElements('firstName').val(),
validator.getFieldElements('lastName').val()].join(' ');
$('#helloModal')
.find('.modal-title').html('Hello ' + fullName).end()
.modal();
}
});
});
</script>
BootstrapValidator demo的更多相关文章
- bootstrapValidator 使用(包含入门demo,常用方法,以及常用的规则)
一 什么是bootstrapValidator? -- 一个基于 jquery,boostrap 的表单验证框架....简单实用上手快,页面美观还过得去,不废话了,直接撸. 二 boots ...
- Bootstrap表单验证插件bootstrapValidator使用方法整理
插件介绍 先上一个图: 下载地址:https://github.com/nghuuphuoc/bootstrapvalidator 使用方法:http://www.cnblogs.com/huangc ...
- bootstrapValidator 表单验证
官网下载地址:http://plugins.jquery.com/bootstrapValidator/ html代码 <!DOCTYPE html> <html> <h ...
- JS组件系列——Form表单验证神器: BootstrapValidator
前言:做Web开发的我们,表单验证是再常见不过的需求了.友好的错误提示能增加用户体验.博主搜索bootstrap表单验证,搜到的结果大部分都是文中的主题:bootstrapvalidator.今天就来 ...
- bootstrapValidator.js,最好用的bootstrap表单验证插件
前言:做Web开发的我们,表单验证是再常见不过的需求了.友好的错误提示能增加用户体验.博主搜索bootstrap表单验证,搜到的结果大部分都是文中的主题:bootstrapvalidator.今天就来 ...
- 黄聪: Bootstrap之Form表单验证神器: BootstrapValidator(转)
前言:做Web开发的我们,表单验证是再常见不过的需求了.友好的错误提示能增加用户体验.博主搜索bootstrap表单验证,搜到的结果大部分都是文中的主题:bootstrapvalidator.今天就来 ...
- bootstrapValidator表单验证插件
bootstrapValidator——一个很好用的表单验证插件,再也不用手写验证规则啦! bootstrapValidator官方文档:http://bootstrapvalidator.votin ...
- Form表单验证神器: BootstrapValidator
前言:做Web开发的我们,表单验证是再常见不过的需求了.友好的错误提示能增加用户体验.博主搜索bootstrap表单验证,搜到的结果大部分都是文中的主题:bootstrapvalidator.今天就来 ...
- BootstrapValidator:表单验证神器
前言:做Web开发的我们,表单验证是再常见不过的需求了.友好的错误提示能增加用户体验.博主搜索bootstrap表单验证,搜到的结果大部分都是文中的主题:bootstrapvalidator.今天就来 ...
随机推荐
- python-----定制群发微信消息
如何使用表格中的信息群发微信消息? 如何读取csv? → 使用内置模块csv 如何按对应信息发送到微信?→ 使用第三方库wxpy 以下代码素材自取:链接:https://pan.baidu.co ...
- 03 数据解析-Xpath
Xpath解析 XPath在Python的爬虫学习中,起着举足轻重的地位,对比正则表达式 re两者可以完成同样的工作,实现的功能也差不多,但XPath明显比re具有优势,在网页分析上使re退居二线. ...
- linux 配置文件要不要加上#! /bin/bash
现在一般的linux系统默认的shell都是bash.所以但很多unix系统可能会用bourne shell.csh或者ksh等来作为用户默认shell 如果你在写shell脚本的时候,用的语法只有b ...
- xtu summer individual 2 E - Double Profiles
Double Profiles Time Limit: 3000ms Memory Limit: 262144KB This problem will be judged on CodeForces. ...
- python023 Python3 标准库概览
Python3 标准库概览 操作系统接口 os模块提供了不少与操作系统相关联的函数. >>> import os >>> os.getcwd() # 返回当前的工作 ...
- Hadoop JVM调整解决 MapReduce 作业超时问题
摘要:由于业务需要,在mapreduce汇总时需要关联两个基础表,一个60M左右,不影响mr运行,另一个表,大小约为380M,行数为1700万行左右,在默认配置下,一旦加载这个数据就会在reduce阶 ...
- hdu 2669 扩展欧几里得(裸)
#include<stdio.h> #include<iostream> #define ll __int64 ll gcd(ll a,ll b,ll &x,ll &a ...
- 只有代码不会撒谎,如何通过Spring boot源码查看其对于各个框架的默认配置
我发现很多开发对于看源码都有种恐惧心理,其实不必这样,大部分优秀的源码写的都挺直观的,很多时候,你在搜索引擎上搜到的一些东西并不一定是对的,但源码肯定造不了假,毕竟不管你怎么想,它就在那里,该是什么意 ...
- vi/vim复制粘贴命令
1. 选定文本块.使用v进入可视模式,移动光标键选定内容. 2.复制的命令是y,即yank(提起) ,常用的命令如下: y 在使用v模式选定了某一块的时候,复制选定块到缓冲区用: ...
- 寒武纪camp Day1
补题进度:8/10 A(组合计数) 题意: 一个人站在数轴原点,每秒有1/4概率向前走一步,1/4概率向后走一步,1/2概率不动,问t秒后在p位置的概率. t,p<=100000 分析: 枚举不 ...