Block special characters in input matInput

1

How do I block special characters in:

I tried it this way, but it did not really work:

pattern="^ [a-zA-Z0-9] + $"

Does anyone have any ideas?

Thank you in advance!

    
asked by anonymous 04.10.2018 / 13:08

1 answer

1

I found a solution:

<input keypress="return String.fromCharCode(event.charCode).match(/[^a-zA-Z0-9]/g) === null">

ANSWER HERE

    
04.10.2018 / 13:31