JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.4.5/css/bootstrapvalidator.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.4.5/js/bootstrapvalidator.min.js"></script>
<form action="login" method="post" id="login" >
<div class="form-group">
<label class="control-label" for="userName">
User Id
</label>
<input type="text" placeholder="Username" name="userName" id="userName" class="form-control lgn">
</div>
<div class="form-group">
<label class="control-label" for="Password">
Password
</label>
<input type="password" placeholder="Password" name="password" id="password" class="form-control lgn">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success lgn" >Login</button>
</div>
</form>
JavaScript
$(document).ready(function() {
$('#login').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
userName: {
validators: {
notEmpty: {
message: 'The first name is required and cannot be empty'
}
}
},
password: {
validators: {
notEmpty: {
message: 'The last name is required and cannot be empty'
}
}
} /* <-- removed comma */
} /* added closing brace */
});
});