Block special characters in <input matInput

Asked

Viewed 653 times

1

How do I block special characters in:

I tried this way, but it didn’t really work:

Pattern=" [a-za-Z0-9]+$"

Does anyone have any idea?

Thanks in advance !

1 answer

1


I found a solution:

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

ANSWER HERE

Browser other questions tagged

You are not signed in. Login or sign up in order to post.