I'm struggling with the code to restrict specific characters to my input box. The code below work - meaning the console is only showing the characters I've allowed in the string. But how do I keep them from showing up in the input?
export function input1_keyPress(event) { var key = event.key; if ("1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz.".indexOf(key) < 0) return; console.log(key); }
Ideally, the characters never show in the input box.
Do you want to delete the forbidden characters from the input after the user has typed them?