Call the method like so: onkeypress="return inputLimiter(event, 'Numbers', this.value, 5);"