版权声明:欢迎转载,请注明沉默王二原创。 https://blog.csdn.net/qing_gee/article/details/49180703
自从使用了BootstrapValidator之后,感觉非常漂亮,但却引发了很多个bug,too much recursion
就是其中一种。
错误代码
<label>账户</label>
<input class="form-control" type="text" autofocus name="username" placeholder="请输入会员编号" autocomplete="off"
data-bv-notempty />
<label>密码</label>
<input class="form-control" type="password" name="password" placeholder="请输入登陆密码" data-bv-notempty/>
<div class="checkbox">
<label> <input type="checkbox" value="1" /> 记住我的账号
</label>
</div>
这样的写法对于BootstrapValidator是不符合规则的,虽然这样的写法看起并没有什么错误,但运行的时候就会提示too much recursion
错误,那么经过多番调试后,发现,如果要使用BootstrapValidator,那么对于上面代码中的“账户label”和“账户 input”就必须加入到一个class为“form-group”的div中。
正确代码
<div class="form-group">
<div class="row">
<label>账户</label>
<input class="form-control" type="text" autofocus name="username" placeholder="请输入会员编号" autocomplete="off"
data-bv-notempty />
</div>
</div>
<div class="form-group">
<div class="row">
<label>密码</label>
<input class="form-control" type="password" name="password" autocomplete="off" data-bv-notempty placeholder="请输入登陆密码" />
</div>
</div>
<div class="form-group">
<div class="row">
<div class="checkbox">
<label> <input type="checkbox" value="1" /> 记住我的账号
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<button class="btn btn-lg btn-primary btn-block" type="submit">提交</button>
</div>
</div>
相关文章
笑对现实的无奈,不能后退的时候,不再傍徨的时候,永远向前 路一直都在──陈奕迅《路一直都在》
本文出自:【沉默王二的博客】