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
for me the above only worked with the following changes:
jQuery.validator.addMethod("defaultInvalid", function(value, element)
{
switch (element.value)
{
case "Your Name":
if (element.name == "element_name") return false;
break;
default: return true;
break;
}
});
I think this is better:
jQuery.validator.addMethod("defaultInvalid", function(value, element)
{
return !(element.value == element.defaultValue);
});