title: How to use defer for inline Javascript
body: <p>I am developing a webpage in PHP with Laravel. I want to use the attributes "defer" or "async" for my javascript files, but I have a few problems.
  In every document, I load a header which contains:</p>
  
  <pre><code>{{ Html::script('js/jquery.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/bootstrap.min.js', array('defer' =&gt; 'defer')) }}
  
  {{ Html::script('js/pjax.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/jquery.cookie.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/blur.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/scrollbar.js', array('defer' =&gt; 'defer')) }}
  
  &lt;!--Form--&gt;
  {{ Html::script('js/parsley/parsley.remote.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/parsley/parsley.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/parsley/es.js', array('defer' =&gt; 'defer')) }}
  {{ Html::script('js/icheck.js', array('defer' =&gt; 'defer')) }}
  
  &lt;!--Funciones--&gt;
  {{ Html::script('js/funciones.js', array('defer' =&gt; 'defer')) }}
  </code></pre>
  
  <p>If I give them the attribute async, the don't work properly because some of them are modular.
  So I've tried with the defer attribute and I don't have this problem, but now I have a problem with the inline javascript, because it calls a function of the header. (This is at the bottom of the page).</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  window.addEventListener('popstate', function(e) { 
      eval(document.getElementById("script_biblioteca").innerHTML);
  });
  
  
  //Scripts on back/forward
  section = 'biblioteca';
  url_section = "{{Request::root()}}/"+section+"/";
  
  activar_menu('#menu_biblioteca');
  buscador('#dinamic_search', '#main', section);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>And the error:</p>
  
  <pre><code>ReferenceError: $ is not defined
  ReferenceError: activar_menu is not defined
  </code></pre>
  
  <p>How can I fix that?
  And, I am using the "defer" attribute properly?</p>