title: HTML5 form validation in a bootstrap modal
body: <p>I'm relatively new to jquery and javascript. 
  The form opens up on clicking the button "Open Modal" in the modal.
  Next, when I click on 'Save' in the modal, it should validate the HTML5 form and on successful validation should call another function "addDetails()".</p>
  
  <p>How do I achieve this using existing jquery form validation plugin or any other method? What CDNs I need to refer to while using?</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
      &lt;head&gt;  
          &lt;meta charset="utf-8"&gt;
          &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myFormModal"&gt;Add Details&lt;/button&gt;
  
          &lt;div id="myFormModal" class="modal fade" role="dialog"&gt;
            &lt;div class="modal-dialog"&gt;
  
  
              &lt;div class="modal-content"&gt;
                &lt;div class="modal-header"&gt;
                  &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                  &lt;h4 class="modal-title"&gt;Add details&lt;/h4&gt;
                &lt;/div&gt;
                &lt;div class="modal-body"&gt;
                  &lt;form class="form-horizontal" id="myForm" name="contact" action="#"&gt;
                    &lt;div class="form-group"&gt;
                      &lt;label class="control-label col-sm-3" for="dor"&gt;Date of Registeration:&lt;/label&gt;
                      &lt;div class="col-sm-8"&gt;
                        &lt;input type="date" class="form-control" id="dor" name="dor" required&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                      &lt;label class="control-label col-sm-3" for="name"&gt;Name:&lt;/label&gt;
                      &lt;div class="col-sm-8"&gt;
                        &lt;input type="text" class="form-control" id="name" name="name" required&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                      &lt;label class="control-label col-sm-3" for="weburl"&gt;Website:&lt;/label&gt;
                      &lt;div class="col-sm-8"&gt;
                        &lt;input type="url" class="form-control" id="weburl" name="weburl" required&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                     &lt;label class="control-label col-sm-3" for="myphoto"&gt;Image:&lt;/label&gt;
                      &lt;div class="col-sm-8"&gt;
                        &lt;input type="text" class="form-control" id="myphoto" name="myphoto" required&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;hr /&gt;
                    &lt;div class="form-group"&gt;        
                      &lt;div class="col-sm-offset-3 col-sm-3"&gt;
                        &lt;button type="button" class="btn btn-primary btn-sm" onclick="addDetails()"&gt;Save&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-3"&gt;
                        &lt;button type="reset" class="btn btn-primary btn-sm"&gt;Reset&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;div class="col-sm-3"&gt;
                        &lt;button type="button" class="btn btn-primary btn-sm close-external-modal" data-dismiss="modal"&gt;Close&lt;/button&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/form&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>