My html is:
<input type="text" name="username">
If we write any validation also ,i need the function related stuff to happen in typescript but not java script.
My html is:
<input type="text" name="username">
If we write any validation also ,i need the function related stuff to happen in typescript but not java script.
The simplest way is to use Regex in whatever implementation you need to filter for leading/trailing whitespace. If you want simple validation, try the HTML5 pattern
attribute.
^(?=[A-Za-z0-9])([A-Za-z0-9\s]*)(?<=[A-Za-z0-9])$