jQuery Validate - Hide display validation error messages / show custom errors

前端 未结 3 544
梦如初夏
梦如初夏 2020-12-23 19:13

I\'m using jQuery Validate, but I really don\'t want to have any error messages whatsoever. Rather, I need to have red boxes around offending inputs/selects/etc. These red b

3条回答
  •  别那么骄傲
    2020-12-23 20:08

    You can override the showErrors function:

    jQuery('form').validate({
        showErrors: function(errorMap, errorList) {
            // Do nothing here
        },
        onfocusout: false,
        onkeyup: false,
        rules: {
            email: {
                required: true
            }
        },
        messages: {
            email: {
                required: 'The email is required'
            }
        }
    });
    

提交回复
热议问题