基于Bootstrap jQuery.validate Form表单验证实践
项目结构 :
github 上源码地址:https://github.com/starzou/front-end-example 点击打开
1、form 表单代码
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Form Template</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="plugins/bootstrap/css/bootstrap.css"/>
</head>
<body>
<div class="container">
<h1 class="text-center text-danger">Form 示例</h1>
<form role="form" class="form-horizontal" action="javascript:alert('验证成功,可以提交.');" method="post">
<div class="form-group">
<label class="col-md-2 control-label" for="name">Name</label>
<div class="col-md-10">
<input class="form-control" name="name" type="text" id="name" placeholder="Name" value="" />
</div>
</div>
<div class="form-group"&