JavaScript permite apenas caracteres numéricos

$('#MyTextInput').on('propertychange input', function () {
  let result = $(this).val().replace(/[^\d]+/g, '');
  $(this).val(result);
});
Syntax Error