Super simple email validation with javascript
<p>I'm making a really simple email validation script that basically just checks the following</p>

<ol>
<li>that the email isn't blank</li>
<li>the the email contains an @ symbol with at least 1 character before it</li>
<li>that there is a domain ie @ with at least 2 letters after it</li>
<li>that it ends with a fullstop with at least 2 letters after it</li>
</ol>

<p>I know there are many more checks, but I look at these regex rules and my mind stops working. I figure if I started with something small like this I might be able to wrap my brain around more complex rules.</p>

<p>Currently using some jquery I do the following:</p>

<pre><code> var booking_email = $('input[name=booking_email]').val();

 if(booking_email == '' || booking_email.indexOf('@') == -1 || booking_email.indexOf('.') == -1) {

   // perform my alert

 }
</code></pre>

<p>This is enough to stop 90% of bogus emails so far... I would just like to make it a bit more effective because currently my rule will allow emails like '@domain.com' or 'user@domain.' because it only checks that there is a fullstop and an @ symbol.</p>

<p>Thanks for any tips.</p>
