Jquery 引导验证程序-实际上没有进行任何验证
我一直在研究Bootstrap validator,我复制并格式化了他们的示例,包括了所有必需的Bootstrap和Bootstrap validator以及jQuery代码,但是示例并没有像它所暗示的那样工作 这是我的密码Jquery 引导验证程序-实际上没有进行任何验证,jquery,twitter-bootstrap-3,jqbootstrapvalidation,Jquery,Twitter Bootstrap 3,Jqbootstrapvalidation,我一直在研究Bootstrap validator,我复制并格式化了他们的示例,包括了所有必需的Bootstrap和Bootstrap validator以及jQuery代码,但是示例并没有像它所暗示的那样工作 这是我的密码 <!DOCTYPE html> <html> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/> <!-- Bootstrap 3 --> <
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/> <!-- Bootstrap 3 -->
<link rel="stylesheet" href="bootstrap_validator/css/bootstrapValidator.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script> <!-- Bootstrap 3 -->
<script type="text/javascript" src="bootstrap_validator/js/bootstrapValidator.js"></script>
<form id="registerform" class="form-horizontal">
<div class="form-group">
<label class="col-lg-2 control-label">Account</label>
<div class="col-lg-4">
<input type="text" class="form-control" name="username" placeholder="Username" />
</div>
<div class="col-lg-4">
<input type="text" class="form-control" name="email" placeholder="Email address" />
</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
$('#registerform').bootstrapValidator({
live: 'enabled',
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and cannot be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The username can only consist of alphabetical, number and underscore'
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email is required and cannot be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
}
}
});
});
</script>
</html>
账户
$(文档).ready(函数(){
$('#registerform')。bootstrapValidator({
live:“已启用”,
消息:“此值无效”,
反馈图标:{
有效:“glyphicon glyphicon ok”,
无效:“glyphicon glyphicon删除”,
正在验证:“glyphicon glyphicon刷新”
},
字段:{
用户名:{
消息:“用户名无效”,
验证器:{
注意:{
消息:“用户名是必需的,不能为空”
},
弦长:{
民:6,,
最高:30,
消息:“用户名长度必须大于6个字符且小于30个字符”
},
regexp:{
regexp://^[a-zA-Z0-9+$/,,
消息:“用户名只能由字母、数字和下划线组成”
}
}
},
电邮:{
验证器:{
注意:{
消息:“电子邮件是必需的,不能为空”
},
电子邮件地址:{
消息:“输入不是有效的电子邮件地址”
}
}
}
}
});
});
尝试将id作为邮件,用户名作为属性。像这样
<input type="text" class="form-control" name="username" placeholder="Username" id="username" />
<input type="text" class="form-control" name="email" placeholder="Email address" id="email" />
希望这有帮助尝试将id作为邮件,用户名作为属性。像这样
<input type="text" class="form-control" name="username" placeholder="Username" id="username" />
<input type="text" class="form-control" name="email" placeholder="Email address" id="email" />
希望这有帮助