How to validate US ZIP code using jQuery Validation plugin

前端 未结 4 1094
予麋鹿
予麋鹿 2020-12-09 04:51

I am using the jQuery Validation plugin for validating my form.

I want to validate the zip code as per US ZIPCode format :-

> 12345
> 12345-678         


        
4条回答
  •  没有蜡笔的小新
    2020-12-09 05:02

    Zip code validation routines are provide in additional-methods.js but I would question why you ask for country information if you are going to invalidate the form for any country other than the US? Please remember that only about 5% of the worlds population uses a US zipcode. I would recommend you make you postcode validation routines dependent on the country actually selected by the user.

提交回复
热议问题