Jquery: Form validation not working

前端 未结 2 1897
星月不相逢
星月不相逢 2021-02-06 09:50

I am very new to Jquery and hope you guys can help me with this jquery validation problem.

Been trying to validate the form but it does not validate at all. It accepts a

2条回答
  •  日久生厌
    2021-02-06 10:19

    Hey you need to create custom rule in the library like this

    $.validator.addMethod("valueNotEquals", function(value, element, arg){
      return arg != value;
    }
    

    and then have use it like this

        rules: {
            gender: {valueNotEquals: "default"}                                             
        },
        messages: {
            gender: { valueNotEquals: "Please select a payment method"}           
    
        }
    

提交回复
热议问题