How to add a Not Equal To rule in jQuery.validation

前端 未结 9 943
小鲜肉
小鲜肉 2020-11-28 03:23

I was wondering how to make it so that I could make a rule where a field is not equal to a value. Like I have a field called \'name\' so I don\'t want \'name\' = \'Your Name

9条回答
  •  情歌与酒
    2020-11-28 03:40

    Not sure if you got your answer but:

    return this.optional(element) || value != param;

    won't work if the value is variable.

    It needs to read:

    return this.optional(element) || value != $(param).val();

    Cheers

提交回复
热议问题