title: How to check if jQuery properties have been set in JavaScript and PHP?
body: <p>Before I being, let me clarify I am a newbie to jQuery and JavaScript. I'm sorry if the answer is obvious 
  Okay, I am trying to create a page where the user can select dates and times, and want to use JavaScript and PHP to make sure the user is not returning a blank field (like no date or time set and clicks submit). I am using jQuery's datepicker and a timepicker from Jon Thornton. I successfully created the fields to display that, but I don't know the proper way to call it in JavaScript and check. Here is my code as of now:</p>
  
  <pre><code>    &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
  &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
  &lt;script type='text/javascript' src='../jQuery/jonthornton-jquery-timepicker-dbdea8e/jquery.timepicker.js'&gt;&lt;/script&gt;
  &lt;link rel='stylesheet' href='../jQuery/jonthornton-jquery-timepicker-dbdea8e/jquery.timepicker.css'&gt;
  &lt;script&gt;
    $( function() {
      $( "#datepicker" ).datepicker({maxDate: "+2M", dateFormat: 'yy-mm-dd'});
    } );
      $(function(){
     $('.scrollDefaultExample').timepicker({ 'scrollDefault': 'now' }); 
  });
  &lt;/script&gt;
  
  &lt;script&gt;
  function validateForm() {
      var date = document.forms["Time_Slot"]["datePick"].value;
      var date2 = document.getElementById("datepicker");
      var main_timeSlot = document.forms["Time_Slot"]["timeSlot"].value;
      var add1 = document.forms["Time_Slot"]["additional_1"].value;
      var add2 = document.forms["Time_Slot"]["additional_2"].value;
      var add3 = document.forms["Time_Slot"]["additional_3"].value;
      var add4 = document.forms["Time_Slot"]["additional_4"].value;
      var add5 = document.forms["Time_Slot"]["additional_5"].value;
      var add1Box = document.forms["Time_Slot"]["additional_1_box"].value;
      var add2Box = document.forms["Time_Slot"]["additional_2_box"].value;
      var add3Box = document.forms["Time_Slot"]["additional_3_box"].value;
      var add4Box = document.forms["Time_Slot"]["additional_4_box"].value;
      var add5Box = document.forms["Time_Slot"]["additional_5_box"].value;
      alert("yolo");
      console.log(date);
      if (date2 == null || date == "" || date == " ") {
          alert("A date must be chosen!");
          return false;
      }
      else if (lname == null || lname == "" || lname == " ") {
          alert("The last name field should be complete!");
          return false;
      }
      else if (email == null || email == "" || email == " ") {
          alert("The email field should be complete!");
          return false;
      }
      else if (password == null || password == "" || password = " ") {
          alert("A valid password must be entered! Note: it cannot contain just a space.");
          return false;
      }
  }
  &lt;/script&gt;
  
  &lt;form name="Time_Slot" method="POST"&gt;
      &lt;fieldset&gt;
          &lt;p&gt;Date: &lt;input type="text" id="datepicker" name="datePick"&gt;&lt;/p&gt;
          &lt;p&gt;Time: &lt;input type="text" class="scrollDefaultExample" name="timeSlot"&gt;&lt;/p&gt;
          &lt;br&gt;
          &lt;label&gt;&lt;input type="checkbox" name="additional_1" value="extra_1"&gt; Additional Time Slot: &lt;input type="text" class="scrollDefaultExample" name="additional_1_box"&gt;&lt;/label&gt; &lt;br&gt;&lt;br&gt;
  
          &lt;label&gt;&lt;input type="checkbox" name="additional_2" value="extra_2"&gt; Additional Time Slot: &lt;input type="text" class="scrollDefaultExample" name="additional_2_box"&gt;&lt;/label&gt; &lt;br&gt;&lt;br&gt;
  
          &lt;label&gt;&lt;input type="checkbox" name="additional_3" value="extra_3"&gt; Additional Time Slot: &lt;input type="text" class="scrollDefaultExample" name="additional_3_box"&gt;&lt;/label&gt; &lt;br&gt;&lt;br&gt;
  
          &lt;label&gt;&lt;input type="checkbox" name="additional_4" value="extra_4"&gt; Additional Time Slot: &lt;input type="text" class="scrollDefaultExample" name="additional_4_box"&gt;&lt;/label&gt; &lt;br&gt;&lt;br&gt;
  
          &lt;label&gt;&lt;input type="checkbox" name="additional_5" value="extra_5"&gt; Additional Time Slot: &lt;input type="text" class="scrollDefaultExample" name="additional_5_box"&gt;&lt;/label&gt; &lt;br&gt;&lt;br&gt;
  
          &lt;p&gt;&lt;input type="submit" name="submit" value="Create Available Appointments"  onclick="return validateForm()"&gt;&lt;/p&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When I click on the button to submit, I am not being warned that the date is not set. It would be grateful of you if you can show me a way.
  Thank you in advance!</p>