jquery.validation - how to ignore default values when validating mandatory fields

前端 未结 8 1151
一向
一向 2020-12-03 00:00

I am using jquery validation plugin to validate a registration form.

Each text input field has instructions pre-filled as values in the input box

ex: for a

8条回答
  •  忘掉有多难
    2020-12-03 00:43

    I think this is better:

    jQuery.validator.addMethod("defaultInvalid", function(value, element) 
    {
        return !(element.value == element.defaultValue);
    });
    

提交回复
热议问题