How would you go about validating 2 different regular expressions in jQuery or JS?
My JS Code:
function validate(){
var MyField = document.getElementById('MyField');
if (MyField.value == null || !MyField.value.toString().match(/^(\d{3})-?\d{2}-?\d{4}$/) || !MyField.value.toString().match(/^(\d{2})-?\d{7}$/));
alert('Ivalid Entry ...');
return false;
}
My HTML:
<form action="">
<input id="MyFIeld" name="MyField" type="text" />
<input type="submit" value="Submit" onClick="validate();" />
</form>
Basically its for Tax ID and SSN formatting properly. ##-####### or ###-##-#### ... I am open to JS or jQuery solutions...all help much appreciated.