TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Validate Email Id using Regex and JQuery
Shridhar Sharma
Aug 24
2015
Code
1.8
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<script type=
"text/javascript"
>
function ValidateEmail(email) {
var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return
expr.test(email);
};
$(
"#validator"
).live(
"click"
, function() {
if
(!ValidateEmail($(
"#txtMail"
).val())) {
alert(
"Invalid email address.Please enter valid email address."
);
}
else
{
alert(
"Valid email address."
);
}
});
</script>
<input type=
"text"
id=
"txtMail"
/>
<input type=
"button"
id=
"validator"
value=
"validate email"
/>
regex
jquery
javascript