Here Mudassar Ahmed Khan has explained with an example, how to allow only AlphaNumeric, Dot (Period) and Underscore characters in Username using JavaScript.
When the Submit Button is clicked, the Username in the TextBox will be validated using JavaScript and Regular Expression (Regex) and if the Username is invalid, the error message will be displayed next to the TextBox using JavaScript.
↧