title: javascript email validation to allow space
body: <p>I have some javascript that validates emails but some customers are having problems with it if they put a space at the end of their email address and don't realise it.  I looked up other solutions on stackoverflow and tried using </p>
  
  <pre><code>$.trim($(element).valid()); 
  </code></pre>
  
  <p>but it didn't work.  Here is the code I am using below:-</p>
  
  <pre><code>            &lt;script type="text/javascript"&gt;
              $('#form1').validate({
                  onfocusout: function (element) {
                     $(element).valid();
                  },
                  rules: {
                      FirstName: 'required',
                      SecondName: 'required',
                      Email: {
                              required: true,
                              email: true
                          },
                      reEmail: {
                              required: true,
                              email: true,
                              equalTo: "#Email"
                          },
                      address: 'required',
                      Town: 'required',
                      County: 'required',
                      Phone: 'required',
                      Mobile: 'required',
                      reMobile: {
                              required: true,
                              equalTo: "#Mobile"
                          },
                  },
                  messages: {
                      FirstName: 'Please enter your firstname',
                      SecondName: 'Please enter your secondname',
                      Email: 'Please enter a valid email address',
                      reEmail: 'Email addresses do not match, please retype email address again',
                      address: 'Please enter address',
                      Town: 'Please enter town',
                      County: 'Please select county',
                      Phone: 'Please enter phone number',
                      Mobile: 'Please enter mobile number',
                      reMobile: 'Mobile numbers do not match, please retype mobile number again',
                  }
              });
  </code></pre>