Javascript validation of Email Address, Numeric Values and an Input Mask for Numbers Only
Feb.05, 2008 in
Development
A couple of very simple yet handy routines for validation of form fields: Function to validate an email address (see original post): function ValidateEmail(email){ var emailReg = “^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$”; var regex = new RegExp(emailReg); return regex.test(email); } Function to validate a number: function ValidateNumber(num) { return num.match(/^\d+$/); } Input mask for a field to only accept [...]
