note 111817 rejected from filter.examples.validation by aharvey
| From: | aharvey@php.net | Date: | Thu, 04 Apr 2013 03:37:22 +0000 |
| Subject: | note 111817 rejected from filter.examples.validation by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194321@lists.php.net to get a copy of this message | ||
Note Submitter: gsuresh2u at gmail dot com
----
Hi, please help me to validate email
$(document).ready(function(){
$('#email').keyup(email_check);
});
function email_check(){
var email = $('#email').val();
if (preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix",
$email)){
$('#email').css('background', '#ffffff url("images/tick.png")
no-repeat right center');
$('#email').parent().find('.result').html('<span
class="ok">email seems Ok!</span>');
$('#new_register').removeAttr('disabled');
} else {
$('#email').css('background', '#ffe5e5 url("images/cross.png")
no-repeat right center');
$('#email').parent().find('.result').html('<span
class="error">enter correct email</span>');
$('#new_register').attr('disabled','true');
}
}