jQuery validation plugin: accept only US, Canada and Mexic zip code?
问题 I'd like to use jQuery validation plugin to validate a zip code field that accept only US, Canadian or Mexican zip code format, but there doesn't seem to be a defined rule for it. I've searched Google but I've found nothing useful. I have to accept only these zip code formats: US: 99999-9999 or 99999 Canada: A9A 9A9 MX: 99999 Appreciate your help. 回答1: Look inside the additional-methods.js file for the various zip code rules. You can copy and tweak them as you see fit. jQuery.validator