You were using ngModelChange to bind event which is not there. Question I tried this approach, and found you needed to use onkeypress = 'return keypresshandler(event)' for it to work. Close(x) icon for password field or obfuscated text input field. Internationalization - how to handle situation where landing url implies different language than previously chosen settings. However on my side I wanted to remove the special chars, so I replaced a slight portion of your code and it works great. You should call function on blur too. Can you be more clear. Html input restrict characters. Can there be democracy in a society that cannot count? It works by matching the input value against a regular expression. Thanks, Thanks for the replying. do I keep my daughter's Russian vocabulary small or not? Input Form controls can be used to mask and allow only specific values that can be entered by a user for example to get Customer ID we only want a user to enter numbers or for a username only alphanumeric characters needed. But that's not the focus of this little plug-in - that's validation plug-ins are for. This is useful in aiding the user enter the correct information such as a number or username. based on that modify it in your typescript, Ya the above snippet is working the same way i wanted. [a-z]{2,3}$"> will restrict the allowed characters according that RegExp pattern (in this case: valid-looking email addresses). @Abhijeet It was coded to solve the problem of questioner so might need to be altered by your need. Create a new file index.html and include jQuery before the closing