jQuery email validation issue -


i found jquery email validation works fine on own. have added other functions validate checkboxes , empty fields. full code here: http://jsfiddle.net/vuags/4/

     function validateemail(email) {       var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;       if( !emailreg.test( email ) ) {         add_color(email, 'orange');         return false;       } else {         add_color(email, white);         return true;       }     } 

the form still return not valid though email valid.

i made changes on fiddle, , works....you can refine code ;)

html:

<input class="email_val" type="email" id="emailin" value=""/> 

js:

function validate_form(){          $('form input:not(.checkbox_wrapper input, .email_val), textarea').each(function(){             if ($(this).val() == '') {                 add_color($(this), red);             }             else {                 add_color($(this), white);             }          });        var emailin = $('#emailin').val();        return (validateemail(emailin) && check_radio_checkb() && true);      }    function validateemail(emailin) {           var regex = /^([a-za-z0-9_\.\-\+])+\@(([a-za-z0-9\-])+\.)+([a-za-z0-9]{2,4})+$/;   alert(regex.test(emailin));        if( !regex.test( emailin ) ) {         add_color(email, 'orange');          return false;       } else {         add_color(email, white);            return true;       }      } 

see worrking fiddle here: http://jsfiddle.net/vuags/9/


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -