I'm using a jQuery validation plugin which should validate all the inputs in a form, but it stops at the first one. If you click on the second input and leave it blank - everything is ok - it validates...
Otherwise - not...
I found some of the same answers - no success...
Here's my fiddle with the example I wrote
FiddleError
//
// jQuery Validate example script
//
// Prepared by David Cochran
//
// Free for your use -- No warranties, no guarantees!
//
$(document).ready(function(){
// Validate
// http://bassistance.de/jquery-plugins/jquery-plugin-validation/
// http://docs.jquery.com/Plugins/Validation/
// http://docs.jquery.com/Plugins/Validation/validate#toptions
$('.validate').validate({
highlight: function(element) {
$(element).parent().removeClass('has-success').addClass('has-error');
},
success: function(element) {
element.closest().removeClass('has-error').addClass('has-success');
}
});
}); // end document.ready`enter code here`
Using:
Use name
for the fields instead of id
<div class="form-group">
<label class="control-label" for="login_id">Login id:</label>
<input type="text" class="form-control required" name="login_id">
</div>
<div class="form-group">
<label class="control-label" for="password">Password:</label>
<input type="password" class="form-control required" name="password">
<div class="forgot"> <a href="#">
Forgot your password?
</a>
</div>
</div>
Demo: Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With