Title: Javascript not loading
Last modified: May 21, 2020

---

# Javascript not loading

 *  Resolved [ealbury](https://wordpress.org/support/users/ealbury/)
 * (@ealbury)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/javascript-not-loading-8/)
 * My javascript is not loading. I use this logic in my html code. When I run this
   program with a CSS file in my IDE it works but the Javascript logic does not 
   seem to be applied to my WordPress page. The CSS and HTML code does seem to be.
   I’ve selected Javascript from the plugin options and the correct page. Am I missing
   some script in the Javascript code? Thanks
 * <script>
 *  var targetDate = new Date();
    var current = targetDate.getDate(); var last =
   current + 1;
 *  var startDate = new Date(targetDate.setDate(current)).toUTCString().split(‘ ‘).
   slice(0,4).join(‘ ‘);
 *  var appointments = [startDate];
    var dayList = []; var dayListMultiplied = [];
   var timesAdded = []; var multiplyThisManyTimes = 1; var finalList = [];
 *  function createAppointmentsList() {
    while (appointments.length < 14) { var 
   lastDate = new Date(targetDate.setDate(last)).toUTCString().split(‘ ‘).slice(
   0,4).join(‘ ‘); appointments.push(lastDate); last += 1; } }
 *  function checkDays() {
    for (var i = 0; i < appointments.length; i++) { if (
   appointments[i].includes(‘Mon’)|| appointments[i].includes(‘Wed’)|| appointments[
   i].includes(‘Fri’)) { dayList.push(appointments[i]); } } }
 *  function multiplyDays() {
    for (var i = 0; i < dayList.length; i++) { for(var
   k = 0; k < multiplyThisManyTimes; k++) { dayListMultiplied.push(dayList[i]); }}}
 *  var timeSlots = [“2:00pm-2:10pm”, “2:10pm-2:20pm”, “2:20pm-2:30pm”, “2:30pm-
   2:40pm”, “2:40pm-2:50pm”, “2:50pm-3:00pm”]
 *  function addTimes() {
    for (var i = 0; i < dayListMultiplied.length; i++) { 
   for (var t = 0; t < timeSlots.length; t++) finalList.push(dayListMultiplied[i]
   + ” ” + timeSlots[t]); } }
 *  function countDays() {
    var numberOfDays = dayListMultiplied.length; return 
   numberOfDays; }
 *  createAppointmentsList()
    checkDays(); multiplyDays(); countDays(); addTimes();
 * </script>
 * Here is my html code:
 * <!DOCTYPE html>
    <html lang=”en”> <head> <meta charset=”utf-8″ /> <!–<meta name
   =”viewport” content=”width=device-width. initial-scale=1.0″ />–>
 *  <title>Reading Refugees Support Group</title>
 *  <link rel=”stylesheet” type=”text/css” href=”style.css” media=”screen”/>
    <script
   type=”text/javascript” src=”scripts.js”></script> </head> </head> <body> <h1>
   Book An Appointment</h1> <form action=”Link to the form processor script” method
   =”post”> <div class=”contact-details”> <p> First Name: <input type=”text” name
   =”FirstName” id=”First-Name” value=”Enter Your First Name” size=”25″/> </p> <
   p> Last Name: <input type=”text” name=”LastName” id=”Last-Name” value=”Enter 
   Your Last Name” size=”25″/> </p> <p> Email: <input type=”text” name=”Email” id
   =”Email” value=”Enter Your Email Address” size=”40″/> </p> <p> Phone Number: 
   <input type=”text” name=”PhoneNumber” id=”Phone-Number” value=”Enter Your Phone
   Number” size=”40″/> </p> </div> <p> <select id=”selectAppointment”> <option value
   =”default”>Select an Appointment</option> </select> <script>
 *  var selectAppointment = document.getElementById(“selectAppointment”);
 *  for (var i = 0; i < finalList.length; i++)
    { var option = document.createElement(“
   OPTION”), txt = document.createTextNode(finalList[i]); option.appendChild(txt);
   option.setAttribute(“value”, finalList[i]); selectAppointment.insertBefore(option,
   selectAppointment.lastChild); }
 *  </script>
    <br> </br> <select id=”selectEnquiry”> <option value=”default”>Select
   an Enquiry</option> </select>
 *  <script>
 *  var selectEnquiry = document.getElementById(“selectEnquiry”);
    var enquiryList
   = [“finances”, “legal”, “housing”, “employment”, “aid”];
 *  for (var i = 0; i < enquiryList.length; i++)
    { var option = document.createElement(“
   OPTION”), txt = document.createTextNode(enquiryList[i]); option.appendChild(txt);
   option.setAttribute(“value”, enquiryList[i]); selectEnquiry.insertBefore(option,
   selectEnquiry.lastChild); } </script> <p> <input type=”submit” name=”submit” 
   value=”Submit”/> </p> </form>
 * </body>
    </html>
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjavascript-not-loading-8%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [ealbury](https://wordpress.org/support/users/ealbury/)
 * (@ealbury)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/javascript-not-loading-8/#post-12877171)
 * I found a solution. I just had to move the JavaScript Code Block up the top of
   the Code Blocks in the plugin admin window. I didn’t realise they ran in order.
 *  Thread Starter [ealbury](https://wordpress.org/support/users/ealbury/)
 * (@ealbury)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/javascript-not-loading-8/#post-12877176)
 * Resolved.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Javascript not loading’ is closed to new replies.

 * ![](https://ps.w.org/css-javascript-toolbox/assets/icon-256x256.gif?rev=3132209)
 * [CSS & JavaScript Toolbox](https://wordpress.org/plugins/css-javascript-toolbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/css-javascript-toolbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/css-javascript-toolbox/)
 * [Active Topics](https://wordpress.org/support/plugin/css-javascript-toolbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/css-javascript-toolbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/css-javascript-toolbox/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 2 replies
 * 1 participant
 * Last reply from: [ealbury](https://wordpress.org/support/users/ealbury/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/javascript-not-loading-8/#post-12877176)
 * Status: resolved