Good Day.
I am using the following code to validate data on a HTML page
function checkTermMoYr (strng) {
var error = "";
if (strng == "") {
error = "You didn't enter a Loan Term.\n";
}
//var illegalChars = /\W/;
var illegalChars = \s;
// allow only letters, numbers, and underscores
if (illegalChars.test(strng)) {
error = "The Loan Term contains illegal characters.\n";
}
return error
}
What I can't figure out is how to allow only letters, numbers and spaces. Any help is greatly appreciated.