Skip navigation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$('#form').validate({

errorLabelContainer:'#errorContainer',
showErrors: function(errorMap, errorList) {
if(errorList.length)
{
$('#errorContainer').html(errorList[0]['message']);
}
},
highlight:function(element,errorClass){
$(element).parent('td').addClass('error');
},
unhighlight:function(element,errorClass){
$(element).parent('td').removeClass('error');
}
})

4 Comments

  1. thanks a lot for this,
    is it possible to keep the class to the input fields show[so] we can style with css the background color of the form?

    thanks a lot again,
    all the best

  2. yes. you mean error class? why cant you do something like:
    form input{color:black}

  3. i use css to style the error (class) inputs, but after i insert the code you provide, the error class removed from the input fields that have errors, so i can’t include the .error input{} in my css.

    thanks a lot for your example and support!!!

    all the best!
    Philip

  4. if you wanna keep the error class even though there is no longer an error on that input just comment out
    $(element).parent(‘td’).removeClass(‘error’);

    but you should do what i suggested above:
    form input{color:black}


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>