title: Email validation for specific domain name
body: <p>I have the following form. I want to validate the email field .it should only contain for domain name "<strong>@somename.com</strong> " when the user clicks submit.</p>
  
  <p>The mail should only be validated when the check box is clicked to show the email field.</p>
  
  <p>If the email is invalid i want to prevent submission</p>
  
  <pre><code>&lt;form class="form-horizontal" id="rForm" data-toggle="validator" role="form"&gt;
  
                          &lt;div class="form-group"&gt;
                              &lt;div class="col-xs-offset-3 col-xs-8"&gt;
                                  &lt;label class="checkbox-inline col-xs-10"&gt;
                                      &lt;input type="checkbox" ID="chkbx"&gt; Email 
                                  &lt;/label&gt;
                              &lt;/div&gt;
  
                          &lt;/div&gt;
                          &lt;div class="form-group email"&gt;
                              &lt;div class="col-xs-offset-3 col-xs-8"&gt;
  
                                  &lt;div class="col-xs-8"&gt;
                                      &lt;input type="text" class="form-control "  placeholder="Enter email"&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                                  &lt;div class="form-group"&gt;
                              &lt;div class="col-xs-offset-3 col-xs-8"&gt;
                                  &lt;input type="reset" class="btn btn-default" id="rset" value="Reset"&gt;
                                  &lt;input type="submit" class="btn btn-primary" id="submit" value="Submit"&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt; 
  </code></pre>
  
  <p>JS</p>
  
  <pre><code> $("#submit").on('keypress click', function(e){
              e.preventDefault();
  $('#chkbx').hide();
  $('#chkbx').click(function () {
         // This will show / hide your element accordingly
         $('.email').toggle();
  });
  
  
      });
  </code></pre>