javascript input a specific character once
i made a function where you can only input alphabets , @ and ( . ) period.
how can i set that i can only input the "@" sign once and after that it
will automatically add "email.com" . for example i input my email like
"stackoverflow" and after i hit "@" it will automatically add "email.com"
and that "@" can only be inputted once..
here's my code
function fnEmailAlpha(e)
{
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //Firefox
if ((key>96 && key<123) || (key>64 && key<90) || key==46 || key == 64
|| key == 95)
{
return true;
}
else
{
return false;
}
}
No comments:
Post a Comment