title: Reload javascript on html change
body: <p>In my site's index.html I have a div element that changes when a menu item gets clicked (with jquery). The pages that get inserted into this element all have some javascript functions in them. However, I load my javascript files in the index.html right before the body closes. These files don't 'reload' when this div element changes, so the javascript doesn't work on these pages. How would I fix this issue? Do I have to reload the javascript files on the change of the element? And if so, how?</p>
  
  <p>edit:
  Sorry, these are the codes for the page inserts:</p>
  
  <pre><code>$("li.load-page").click(function() {
  
    var pagina = $(this).data("page") + ".html";
    console.log(pagina);
    $("#main-content").load(pagina);
  });
  </code></pre>
  
  <p>main-content is an empty div in index.html.</p>
  
  <p>In one of the pages that gets inserted I use the jquery accordion in my html for example, but it doesn't work since it's included in the head, and the page doesn't refresh on insertion:</p>
  
  <pre><code>$(function() {
      $( "#accordion" ).accordion({
          collapsible: true,
          heightStyle: "content"
      });
  });
  </code></pre>
  
  <p>EDIT2: I have simulated my problem here: <a href="https://jsfiddle.net/ktoeon2f/2/" rel="nofollow">https://jsfiddle.net/ktoeon2f/2/</a></p>