Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add another statement on keypress on email validation with jQuery
    primarykey
    data
    text
    <p>Validations is working fine, if valid email is entered, displays a hidden box if not valid is showing a message error on a overlay, but how to check if keydown or return? any ideas guys?</p> <p>This is my code, which can also be <a href="http://jsfiddle.net/bKT9W/" rel="nofollow">accessed in a jsFiddle</a>:</p> <pre><code>function validateEmail() { var validEmail = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; $('#user_email').blur(function(){ if (validEmail.test(this.value)) { $('.masked-check').fadeIn(300) } else { $('.masked-check').fadeOut(300); $('.overlay').append('&lt;div class="alert alert-error" id="errors"&gt;&lt;/div&gt;'); showOverlay($('#errors').html('Please enter a valid email...')); } }); } validateEmail(); </code></pre> <p>I not sure if this is the way to do it but works for me now, the only issue is not listening to a keypress keyup or keydown. Here is the updated <a href="http://jsfiddle.net/creativestudio/bKT9W/3/" rel="nofollow">http://jsfiddle.net/creativestudio/bKT9W/3/</a> I am not sure is this is the best way to do it but works for now.</p> <pre><code> function validateEmail() { var validEmail = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; $('#user_email').blur(function(){ $('.masked-check').hide(); if (validEmail.test(this.value)) { $('.masked-check').fadeIn(300) } else { $('.masked-check').fadeOut(300); $('.overlay').append('&lt;div class="alert alert-error" id="errors"&gt;&lt;/div&gt;'); showOverlay($('#errors').html('Please enter a valid email...')); } if ($('#user_email').val()=='') { $('.masked-check').hide() } }); } validateEmail(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload