title: Code only works when I put it into body instead of head
body: <p>I'm trying to learn some web programming and I'm having this issue. </p>
  
  <p>I use FullCalendar on my site and I placed creation of calendar on separate JavaScript file. That's funktiot.js. Then I have my index.php file which includes first JQuery and then my funktiot.js. After that I call my calendar creation function. However it's only working when I put includes and method call to body. </p>
  
  <p>E.g this won't work</p>
  
  <pre><code>&lt;head&gt;
    &lt;script src='libs/fullcalender/lib/jquery.min.js'&gt;&lt;/script&gt;
  
    &lt;script src="libs/bootstrap/js/bootstrap.js"&gt;&lt;/script&gt;
  
    &lt;script src='libs/fullcalender/lib/moment.min.js'&gt;&lt;/script&gt;
    &lt;script src='libs/fullcalender/fullcalendar.js'&gt;&lt;/script&gt;
    &lt;script src="libs/fullcalender/lang/fi.js"&gt;&lt;/script&gt;
  
    &lt;script src="js/funktiot.js"&gt;&lt;/script&gt;
  
    &lt;script type='text/javascript'&gt;
        $(document).load(luoKalenteri("#calendar", &lt;?php echo $_GET["id"]; ?&gt;));
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"&gt;
           &lt;div id='calendar'&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>but this does</p>
  
  <pre><code>&lt;head&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"&gt;
           &lt;div id='calendar'&gt;&lt;/div&gt;
      &lt;/div&gt;
  
    &lt;script src='libs/fullcalender/lib/jquery.min.js'&gt;&lt;/script&gt;
  
    &lt;script src="libs/bootstrap/js/bootstrap.js"&gt;&lt;/script&gt;
  
    &lt;script src='libs/fullcalender/lib/moment.min.js'&gt;&lt;/script&gt;
    &lt;script src='libs/fullcalender/fullcalendar.js'&gt;&lt;/script&gt;
    &lt;script src="libs/fullcalender/lang/fi.js"&gt;&lt;/script&gt;
  
    &lt;script src="js/funktiot.js"&gt;&lt;/script&gt;
  
    &lt;script type='text/javascript'&gt;
        luoKalenteri("#calendar", &lt;?php echo $_GET["id"]; ?&gt;);
    &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I thought the first one would work as well as I use $(document).load and include JQuery before everything else? What am I doing wrong?</p>