Would like to check the validation for an integer value using JavaScript. At the moment, this works fine for integers, but I want it to allow an empty string, ""
function validateInt(inputString, columnName) {
var errorOutput = "";
var isNum = /^\d+$/.test(inputString);
if (!isNum) {
errorOutput += "<br>* Column " + columnName + " can only contain numbers. ";
}
return errorOutput;
}
An extra condition in the var isNum = ...
? Any ideas?