I\'m trying to get my login form to only validate if only numbers were inputted. I can it to work if the input is only digits, but when i type any characters after a number,
function validateNumber(e) { const pattern = /^[0-9]$/; return pattern.test(e.key ) }
This approach doesn't lock numlock numbers, arrows, home, end buttons and etc