javascript - Textbox to accept only one @ -
i'm creating email field in html, can accept 1 @
?
for example email:
chong!#$@gmail.com
- should invalid because of there others special characters included
or
ch@ng@gmail.com
- should invalid because there 2 @
's.
the accepted special character should 1 @
, how do in javascript/jquery? sorry don't know in regex. or there way validate email format?
you can use following regex in input:
<input type="email" pattern="[a-za-z0-9.]+\@[a-za-z0-9.]+\.[a-za-z]+" />
Comments
Post a Comment