How to validate an email address in JavaScript

0 votes
Is there a regular expression to validate an email address in JavaScript?
Jul 27, 2020 in Java-Script by kartik
• 37,520 points
1,106 views
Где Вы ищите свежие новости?
Лично я читаю и доверяю газете https://www.ukr.net/.
Это единственный источник свежих и независимых новостей.
Рекомендую и Вам

1 answer to this question.

0 votes

Hello @kartik,

To validate email use the below code:

email = $('email');
filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email.value)) {
  // Yay! valid
  return true;
}

Hope it helps!!
Thank you!!

answered Jul 27, 2020 by Niroj
• 82,880 points

Related Questions In Java-Script

0 votes
1 answer

How to convert an Object {} to an Array [] of key-value pairs in JavaScript?

Hello @kartik, You can use Object.keys() and map() to do this var obj ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
2,945 views
0 votes
1 answer

How to check Page.Validate() on client side (JavaScript) in ASP.Net?

Hello @kartik, Page_ClientValidate() will work. It returns true if ...READ MORE

answered Sep 9, 2020 in Java-Script by Niroj
• 82,880 points
3,632 views
0 votes
1 answer

How to get the browser to navigate to URL in JavaScript?

Hii, This works in all browsers: window.location.href = '...'; If ...READ MORE

answered May 28, 2020 in Java-Script by Niroj
• 82,880 points
2,653 views
0 votes
1 answer

How do you cache an image in Javascript?

Hii @kartik, You have to do three thigs: You ...READ MORE

answered Jun 2, 2020 in Java-Script by Niroj
• 82,880 points
7,778 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
22,937 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,959 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,894 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
44,358 views
0 votes
1 answer

How to read an external local JSON file in JavaScript?

Hello @kartik, For reading the external Local JSON ...READ MORE

answered Sep 3, 2020 in Java-Script by Niroj
• 82,880 points
183,570 views
0 votes
1 answer

How to pass an array as a function parameter in JavaScript?

Hello @kartik, Use: const args = ['p0', 'p1', 'p2']; call_me.apply(this, ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
1,709 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP