sta*_*low 19 forms validation twitter-bootstrap
尝试使用bootstrap的样式进行表单验证.
我使用这个JavaScript验证,这是定制的引导: https://github.com/ddarren/jQuery-Live-Form-Validation-For-Twitter-Bootstrap
在头部:
<link href="bootstrap.css" rel="stylesheet">
<script src="jquery.validate.js" type="text/javascript">
Run Code Online (Sandbox Code Playgroud)
在身体里:
<form id="Form" action="" method="post">
<div class="control-group">
<input type="text" class="span3" id="Mobile" placeholder="Mobile
Phone Number" name="Mobile">
</div>
<div class="control-group">
<button type="submit" class="btn btn-primary btn-large">Submit
</button></p>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
它没有突出显示bootstrap错误样式的字段.我出错的任何想法?提前致谢.
小智 26
我正在做类似的事情,所以我想我可以帮助你.
首先,jQuery-Live-Form-Validation-For-Twitter-Bootstrap库已经很老了(2009年9月).
它使用版本1.3.2的jQuery的(最新为1.7.1),它并没有采用原有的引导,在所有的文件!
如果你从github网站下载了jQuery-Live-Form-Validation-For-Twitter-Bootstrap(我相信你做了),你可以轻松地在css文件夹中检查该库的作者编写的两个css文件.
回答你的问题,我下载了这个lib,我已经粘贴了你的代码......它有效.简单地说,你需要有头这(在文件夹和的文件):
<link rel="stylesheet" type="text/css" href="stylesheets/jquery.validate.css" />
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
<script src="lib/jquery/jquery-1.3.2.js" type="text/javascript">
</script>
<script src="javascripts/jquery.validate.js" type="text/javascript">
</script>
Run Code Online (Sandbox Code Playgroud)
什么最初取自jQuery-Live-Form-Validation-For-Twitter-Bootstrap.
如果你真的想用jQuery进行Twitter Bootstrap表单验证,我想建议你使用组合的Twitter Bootstrap和jQuery Validation Plugin.
我现在正在努力,它完美无缺.