bootstrapValidator表单校验、更改状态、新增、移除校验字段的实例代码
(编辑:jimmy 日期: 2024/12/27 浏览:3 次 )
注意:jQuery报 Maximum call stack size exceeded
错误描述:超出最大调用堆栈大小
错误原因:内部形成递归
解决方案: html 写法不规范,更改 html 写法,可参考官网示例,或下面代码。
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>validate</title> <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.css" rel="stylesheet"> <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-validator/0.5.3/css/bootstrapValidator.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="row"> <form id="inputForm"> <div class="form-group"> <label class="col-lg-4 control-label">姓名</label> <div class="col-lg-8"> <input type="text" class="form-control" name="xm" /> </div> </div> <div class="form-group"> <label class="col-lg-4 control-label">性别</label> <div class="col-lg-8"> <input type="text" class="form-control" name="xb" /> </div> </div> <div class="form-group"> <label class="col-lg-4 control-label">年龄</label> <div class="col-lg-8"> <input type="text" class="form-control" name="nl" /> </div> </div> </form> <div class="row"> <button id="btn1" class="btn btn-primary" >提交</button> <button id="btn2" class="btn btn-primary" >更改校验状态</button> <button id="btn3" class="btn btn-primary" >增加校验字段</button> <button id="btn4" class="btn btn-primary" >移除校验字段</button> <button id="btn5" class="btn btn-primary" >重置表单校验</button> </div> </div> </div> </body> <script src="/UploadFiles/2021-04-02/jquery.js">总结
下一篇:jQuery 常用特效实例小结【显示与隐藏、淡入淡出、滑动、动画等】