bower install input-validator.js
git clone https://github.com/rtivital/validate.git
body
<body> ... <script src="input-validator.min.js"></script> </body>
var emailInput = new Validator.init(document.getElementById('email'), { rules: { min: 5, max: 20, match: 'email' }, onError: onError, onSuccess: onSuccess }); var validateEmailBtn = document.getElementById('validate-email'); validateEmailBtn.addEventListener('click', function(e) { emailInput.validate(); }, false);
<div class="input-group center-block"> <label for="email">Your email address:</label> <input type="text" class="form-control" id="email" placeholder="example@email.com"> <span id="email-error-container" class="help-block">Enter your email adress</span> <button class="btn btn-default" id="validate-email">Validate email address</button> </div>