function fieldVerificationInt(el, x){
const allowedCodes = [8, 9, 27, 35, 36, 37, 38, 39, 46, 110];
const pattern = /^\d{0,3}$/g;
document.getElementById(el).oninput = function(e) {
const value = this.value;
if( !(value.replace(/\s/g, '').match(pattern) || allowedCodes.some(code => code === e.keyCode)) ) this.value = value.slice(0, -1);
}
}
\d{0,3}
нужно \d{0,x}
.