Skip to content

US Zipcode validator #90

@tmoullet

Description

@tmoullet

Hi Everyone,

I wrote a simple validator for US zipcodes. Here it is:

jQuery.validator.addMethod("ZipcodeUS",function(a,b){return this.optional(b)||/\d{5}-\d{4}$|^\d{5}$/.test(a)},"This zipcode is invalid");

All it does is check to make sure that the input is either 5 digits or 5 digits+4 digits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions