Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Email validation using JavaScript
WhatsApp
Rajeev Kumar
5y
39.6
k
0
1
25
Blog
<script language =
"javascript"
>
function
checkEmail() {
var
email = document.getElementById(
'txtEmail'
);
var
filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if
(!filter.test(email.value)) {
alert(
'Please provide a valid email address'
);
email.focus;
return
false
;
}
}
< /script>
Take a textbox and button in your aspx page and call the JavaScript function on button click.
<
input
type
=
'text'
id
=
'txtEmail'
/>
<
input
type
=
'submit'
name
=
'submit'
onclick
=
'Javascript:checkEmail();'
/>
email validation code.
People also reading
Membership not found