yo tengo uno mas resumido HTML <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <input type='text' class='form-control input-number' id='coordenaday_mass' maxlength='45' required='required' autofocus> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> //solo numeros $('.input-number').on('input', function () { this.value = this.value.replace(/[^0-9]/g,''); }); //con letras y numeros $('.form-control').on('input', function () { this.value = this.value.replace(/[^0-9a-zA-ZñÑáéíóúÁÉÍÓÚ.(),@ _-]/g,''); }); <!-- language: lang-html --> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <input type='text' class='form-control input-number' id='coordenaday_mass' maxlength='45' required='required' autofocus> JAVASCRIPT <!-- end snippet -->