Ensure a positive integer number in input
问题 I have an HTML input element for positive integer numbers. I need to evaluate this input field and ensure that only proper values are inserted. function exampleFunction(event, element) { // If event is not backspace and Not a Number if (event.which != 8) { //If the event is Not a Number if (isNaN(String.fromCharCode(event.which))) { // Cancels the event event.preventDefault(); } //If the length reached the limit else { var value = document.getElementById(element.id).value; var maxLength =