I am trying to get my code to ignore a specific field that doesn't require text at all, but if it has anything other than numeric values in it, it will give me an error. Instead, it gives me the errors when Nothing is entered. The code I have in question is a regex function for checking numeric value, my validation function calls to the numeric regex function, and if
input.classList.contains "numeric".
If the regex is not validated, it will give an error.
Your regex /^([0-9])+$/ in checkNumeric() expects at least one digit because of the +. Try /^([0-9])*$/. This accepts empty string as well, because * matches 0 til infinity digits.
EDIT: I created a program showing the regex in action.