1

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

1 Answer 1

2

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

Thanks

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.