How to validate email with jQuery and iLead

If you have a contact form or a registration form on your website where users enter their email addresses, validation is crucial. Otherwise you’ll get hundreds of 1234@email.com or whatever in your database. There are number of ways to do email validation, or email verification which is the same, and one of them is connecting your form to iLead service. How do you do that? Simple – via jQuery library, which is relatively easy and fast, and we are going to show you how to do it. So this is the post about how to validate email with jQuery.

Using jQuery on a website you can then check the validity of email addresses on Yahoo, Gmail, Hotmail, etc. You can either set it to validating addresses only, or to reject invalid emails or specific domains. This is basic validation (we’ll explore other ways in upcoming posts), and let’s start with jQuery itself. What is it, you might ask.

What is jQuery?

jQuery is a lightweight JavaScript library, designed specifically to make facilitate the use of JavaScript on websites. The key motto is “write less, do more”, which means that jQuery takes  tasks with many lines of code and puts them into methods – a single line of code. This JS library includes features like HTML/DOM/CSS manipulation, event methods, animations, Ajax. To work with jQuery you should have skills in HTML, CSS and JavaScript, which a common software developer today has, apparently.

How to validate email with jQuery and iLead

To start, you will require to get jQuery and add it to your site. Then it takes three steps to perform and you’ll be able to perform email validation through iLead system. And we know what you’re thinking, but don’t worry – it’s free. 3 things you’ll need to do to verify an email are create a HTML file, define markup and scripting, and enable the validation. So let’s get going.   

Step 1: HTML form. We create a basic HTML file for a web form, so far without validation. This is just a form to gather data from a user who enters it and clicks on the Submit button.  

How to validate email with jQuery

Step 2: Add script. We add jQuery script to a website.

How to validate email with jQuery

Step 3: Enable validation. We add jQuery validation to the form and link it with iLead API.

How to validate email with jQuery

This is where we get email value and program expressions for email validation. The system will test the value of email, and check whether it is valid or not. You will then get alert messages depending on results. On a scale of 1 to 10, it may be “We don’t recommend you to send emails on this address” if the email is definitely invalid, or “Almost sure this email is ok, but there are still minimal risks” (code 7), and so on.

The whole script put together will look like this:

How to validate email with jQuery

Conclusion

As you can see, jQuery plugin is a simple and efficient tool to perform email syntax validation on a website. If you need more than that and your business depends on email marketing, you might want to check iLead capabilities in bulk email verification, API, etc. Find more info at iLead documentation. Finally, if you’re seeking to explore more tools, read our previous post about 25 best email verifier services.

1 comment

How to validate email with Python using iLead verification service
11:49 15.06.2018

[…] This Python script is just one of the ways to perform email validation for you business, go to Validate emails with jQuery to learn more. For info about iLead API, go to Help page. If you have questions or other inquiries […]

Cancel reply