views:

251

answers:

1

Does anyone know how to make a method within jQuery Validation Tool to require an exact text string? (upper/lowercase doesn't matter)

Also where does the method actually get placed?

-Brad

+1  A: 
$.validator.addMethod("mustBeFoo", function(value, element) {
    return (value.toLowerCase && (value.toLowerCase() === "foo"));
},
    "Must be foo!"
);

Put it anywhere. As long as it runs before validation, it will work.

Craig Stuntz