email validation using regular expression, jquery

Below is the code snippet for email validation using regular expression and jquery. Hope this is helpful

$(‘#your button’).click(function(){
var defaultTxt=$(‘#email’).attr(‘title’);
var i=$(‘#your textbox value’).val();
var isValid = validateEmail(i);
if (!isValid){  //upon invalid set your label with error message
$(‘#emailWrapper label’).addClass(‘error’).html(‘Please enter a <strong>valid</strong> email address.’);
else{ //upon success remove error class
$(‘#emailWrapper label’).removeClass(‘error’).html(‘Enter Email’);

return isValid;


function validateEmail(elementValue){

var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return emailPattern.test(elementValue);


I Am suresh(suresh kumar )a Web developer,Freelancer,webdesigner,UI developer from bangalore. Got 6+ yrs of IT experience . I specialize in standards-based XHTML, CSS and JavaScript web development. Each site I develop is built to be search engine friendly (SEO), using the latest development principles and techniques.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *