Javascript - Remove the focus from input
<p>I have an input that display a message for an invalid email format. This message disappear when the format is respected.</p>

<pre><code>$('#id_email.form-control').keyup(function(){
$('span.error-keyup-email').remove();
var inputVal = $(this).val();
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if(!emailReg.test(inputVal)){
  $(this).after('&lt;span style="color:red;" class="error error-keyup-email"&gt;Invalid Email Format.&lt;/span&gt;');
}
});
</code></pre>

<p>The code works very good. That's exactly what I wanted.</p>

<p><strong>Problem :</strong> When I select an email that I have already saved by the browser (Normally it saves email or pseudo for the user). When I don't type my email and I select my email instead, the message still stays under the input, even if it's a correct email format.</p>

<p>Do you have an idea ?</p>

<p>I can give you more details if you want and thank you for taking time on my problem :)</p>

<p>Have a nice day :)</p>