bootstrap验证器在jsp文件中不起作用。验证不会对它执行任何操作。检查元素完成时,它不会显示任何错误 代码如下
<form id="frmreg" method="post">
<div class="row">
<div class="col-md-4" style="margin-top: 10px; text-align: right">
First Name
</div>
<div class="col-md-8">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" style="background-color: #00aeff; border-color: #00aeff;">
<i class="fa fa-user" style="color: #fff"></i></span>
<input type="text" name="firstname" id="firstname" placeholder="First Name" class="form-control">
</div>
</div>
</div>
</div>
js文件代码如下
$(document).ready(function(){
$('#frmreg').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
firstname: {
validators: {
notEmpty: {
message: 'The first name is required'
}
}
},
}
});
});
文件includede是
<link rel="stylesheet" type="text/css" href="../bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../css/bootstrapValidator.min.css"/>
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../js/bootstrapValidator.js"></script>
<script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/clickable_pannel.js"></script>