JavaScript permite apenas caracteres alfanuméricos

$('#MyTextInput').on('propertychange input', function () {
  let result = $(this).val().replace(/[^0-9a-z]/gi, '');
  $(this).val(result);
});
Syntax Error