I have a form in twitter bootstrap:
<div class="form-div"> <form id="fvujq-form1" method="post" action=""> <div class="control-group name"> <fieldset> <label>Name *</label> <input type="text" name="name"> </fieldset> </div> <div class="control-group email"> <fieldset> <label>E-Mail *</label> <input type="text" name="email"> </fieldset> </div> <div class="control-group comment"> <fieldset> <label>Your comment *</label> <textarea name="comment"></textarea> </fieldset> </div> <button class="btn btn-primary">Submit</button> </form> </div>
and this is how I test it with bassistance. Confirm the plugin:
$(document).ready(function() { $("#fvujq-form1").validate({ submitHandler:function(form) { SubmittingForm(); }, success: function(label) { label.html("✔").addClass("valid"); }, onfocusout: function(element) { $(element).valid(); }, focusInvalid: false, highlight: function(element, errorClass, validClass) { $('.form-div').find('.control-group' + element.id).addClass('error'); }, unhighlight: function(element, errorClass, validClass) { $('.form-div').find('.control-group' + element.id).removeClass('error'); }, errorClass: "help-inline", errorElement: "strong"
I want to add .error to a div that is currently being tested, but this code adds a class to each .control-group event, not just the checked one :(
Thank you help 4 years.
source share