In the email input field I am checking for illegal characters using regex, like this:
$("#reg_email").keyup(function(event)
{
var regex = /[()-/+{|}\\[\]?!*+^$<>&#~"'%=_:;]/g;
if ($("#reg_email").val().match(regex))
{
$("#reg_email").notify("Illegal characters: \n( ) - / \\ + { } | [\ ] ? ! * + ^ $ < > & # ~ % = _ : ; '",{position:"right", className:"warn", autoHideDelay: autoHideDelay});
this.value = this.value.replace(regex, "");
}
});
Here is the markup:
<input id="reg_email" type="email" class="form-control placeholder" placeholder="" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" required>
But I've noticed that now I cannot enter a full stop character in the input field, and that is not what I want, since email addresses will contain a full stop. I am aware that '>' has the same keycode as a full stop, but currently I am struggling with finding another way.
How can I achieve this alternatively? Thanks