What I want to do is for the error to take the place of another class in my html, and change to another class for the styling.
e.g. in my HTML I have
<div id="firstname" class="cfield">
<span>First Name:</span>
<label><input id="first" name="first" type="text">*</label>
<span id="firstDesc" class="desc">Only characters</span>
</div>
I want the error message to take the place of the class desc, and then change to class error so the style can change (to red text). Is this possible?
In my JQuery I have:
function checkForm() {
$('#contactform').validate( {
errorElement: 'span',
errorClass: 'desc',
rules: {
first: {
required: true,
minLength: true,
}
},
messages: {
first: {
required: "You must enter a first name",
minLength: "Your first name must have more than 2 characters",
}
}
} );
}