Jquery Validation: How to make fields red

前端 未结 4 1514
春和景丽
春和景丽 2021-02-04 04:51

I am using jquery and jquery.validate.cs (jQuery Validation Plugin 1.8.0) to validate a form. Right now it displays a message next to a field saying : \"This is a required fiel

4条回答
  •  囚心锁ツ
    2021-02-04 05:15

    $("#myform").validate({
       error: function(label) {
         $(this).addClass("error");
       },
    });
    

    use the errorClass parameter to add the .invalid class:

    input.error {
        color: red;
    }
    

提交回复
热议问题