views:

165

answers:

1

Hi there..

Am using the jQuery Validation plugin, found here, which is proving very useful....

However what I would like to do, is instead of adding the class error to the input of any invalid form field. I would like to the class error to a div next to the form field itself. Here is the HTML..

 <div class="label">Surname</div>
 <div><input name="sSurname" id="sSurname" type="text" class="text_field required"></div>

So when the form field is invalid on blur, the error class is added to the input field, and when the form is valid, the error class is removed. I would like to add the same functionality to the div with class label, next to the form field..

Is this possible?

Thanks

A: 

Hey, there is a setting for this in the JQuery Validation plugin file. Search for errorElement: "label" and change it to errorElement: "div"

Thanks

Ross