title: How to hide form on submit
body: <p>Trying to get my form to hide once it has been submitted but i just cant seem to get this to work. Just curious to know what i am missing. The form submits all the details just fine. I have added the below jquery code but still it doesn;t seem to work.</p>
  
  <p>jQuery</p>
  
  <pre><code> $('.form-button').click(function () {
        $('.form').hide();
      });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code> &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                    &lt;div class="form" id="lesson-signup-status"&gt;
                      &lt;form method="post" action="mailer-lessons.php"&gt;
                        &lt;select name="lesson-enquiry" id="lesson-enquiry"&gt;
                          &lt;option value="" disabled selected&gt;Select a lesson&lt;/option&gt;
                          &lt;option value="1 Hour Adult Lesson"&gt;1 Hour Adult Lesson&lt;/option&gt;
                          &lt;option value="1 Hour Joint Lesson"&gt;1 Hour Joint Lesson&lt;/option&gt;
                          &lt;option value="1 Hour Junior Lesson"&gt;1 Hour Junior Lesson&lt;/option&gt;
                          &lt;option value="Have A Go Lesson"&gt;Have A Go Lesson&lt;/option&gt;
                          &lt;option value="Other Enquiry"&gt;Other Enquiry&lt;/option&gt;
                        &lt;/select&gt;
                        &lt;input type="text" name="name" id="name" placeholder="Name" required&gt;
                        &lt;input type="email" name="email" id="email" placeholder="Email" required&gt;
                        &lt;input type="text" name="telephone" id="telephone" placeholder="Contact Number" required&gt;
                        &lt;textarea name="message" id="message" placeholder="Your Message" required style="min-height:50px;"&gt;&lt;/textarea&gt;
                        &lt;input type="submit" class="form-button"&gt;
                      &lt;/form&gt;
                    &lt;/div&gt;
                    &lt;div class="col-sm-10 col-sm-offset-1"&gt;
                      &lt;?php
              if($_GET['success'] == 1) {
                echo "&lt;div class=\"form-messages success\"&gt;Your lesson enquiry has been sent! Thanks for enquiring.&lt;/div&gt;";
              }
              if($_GET['success'] == -1) {
                echo "&lt;div class=\"form-messages error\"&gt;Oops! Something went wrong there, please try again.&lt;/div&gt;";
              }
            ?&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  </code></pre>
  
  <p>php script</p>
  
  <pre><code>&lt;?php
  
       // Get the form fields, removes html tags and whitespace.
      $name = strip_tags(trim($_POST["name"]));
      $name = str_replace(array("\r","\n"),array(" "," "),$name);
      $email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
      $telephone = strip_tags(trim($_POST["telephone"]));
      $lesson_enquiry = strip_tags(trim($_POST["lesson-enquiry"]));
      $message = strip_tags(trim($_POST["message"]));
  
      // Check the data.
      if (empty($name) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
          header("Location: lessons.php?success=-1#lesson-signup-status");
          exit;
      }
  
      // Set the recipient email address. Update this to YOUR desired email address.
      $recipient = "email_address";
  
      // Set the email subject.
      $subject = "$lesson_enquiry enquiry";
  
  
  
      // Build the email content.
      $email_content = "Lesson Type: $lesson_enquiry \n\n";    
      $email_content .= "Name: $name\n\n";
      $email_content .= "Email: $email\n\n";
      $email_content .= "Contact Number: $telephone\n\n";
      $email_content .= "Message: $message\n\n";
  
  
  
      // Build the email headers.
      $email_headers = "From: $name &lt;$email&gt;";
  
      // Send the email.
      mail($recipient, $subject, $email_content, $email_headers);
  
      // Redirect to the index.html page with success code
      header("Location: lessons.php?success=1#lesson-signup-status");
  
  ?&gt;
  </code></pre>