I've tried a lot of things but I can't seem to make it work Problem is whatever I type is considered false, even when I try valid email adress (such as ok@gmail.com)
Here's my code
function validateEmail(email) {
        var re = /[^\s@]+@[^\s@]+\.[^\s@]+/;
        return re.test(email);
    }
 var email = $('input[name = pEmail]').val();  
 
 $('#nPopupSubmit').click(function () {
         if (!validateEmail(email)) {
             $('label[id = pEmailError]').show();
             $('input[name = pEmail]').focus();  
             return false; 
              } else {
                whatever
              });<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<form id="popup1" method="post">
            <fieldset>    
                <input id="pEmail" type="text" placeholder="E-mail" value="E-mail" onclick="this.value=''" class="popup_input" name="pEmail" type="text" /> 
                <label id="pEmailError" style="color:#FF0000; display:none;">Error</label>
                <button type="submit" id="nPopupSubmit" name="nPopupSubmit">Go !</button>          
            </fieldset>
        </form>Do any of you have a clue on what's going on ? Thank you !
 
     
    