I need to have an input box to be only restricted to numeric values when the type is text. I took a look at this answer, but it does not seem to work. HTML text input allows only numeric input
<input type="text" onKeyPress={(event) => {
if (event.charCode >= 48 && event.charCode <= 57 || event.charCode >= 96 && event.charCode <= 105) {
return true;
} else {
return false;
}
}}
className="form-control"
maxLength="5"
ref="zip"
placeholder="Enter Zip Code" />