My goal is to restrict the characters allowed in a text box to the following:
A
to Z
in both upper and lower case, Ñ
and ñ
, and space. I have a function that runs onkeyup:
FieldOnKeyUp(el) { !(/^[A-zÑñ-\s]*$/i).test(el.value)?el.value
= el.value.replace(/[^A-zÑñ-\s]/ig,''):null; }
However, the issue is that the field still accepts certain special characters:
` ^ _ \ ] and [
Any suggestions or insights on how to resolve this issue?