Wordpress scripts not loading correctly?
<p>I have a static html theme I am trying to convert into a WorsPress theme. I have some troubles loading the scripts.</p>

<p>The scripts are being loaded, but they don't work for some reason.</p>

<p>I can see in my source code that jquery is being loaded:</p>

<pre><code>&lt;script type='text/javascript' src='url/wp-includes/js/jquery/jquery.js?ver=1.11.3'&gt;&lt;/script&gt;
&lt;script type='text/javascript' src='url/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'&gt;&lt;/script&gt;
</code></pre>

<p>So in my template folder I have a folder "assets" in this folder I have my scripts in the "js" folder. This is how I load my scripts into the setup.php of my theme.</p>

<pre><code>/**
 * Theme assets
 */
function assets() {
  wp_enqueue_style('style', get_stylesheet_directory_uri() . '/style.css', false, null);

  if (is_single() &amp;&amp; comments_open() &amp;&amp; get_option('thread_comments')) {
    wp_enqueue_script('comment-reply');
  }

  //header scripts
    wp_enqueue_script('backstretch', get_template_directory_uri() . '/assets/js/backstretch.js', ['jquery'], null, false);
    wp_enqueue_script('imagesloaded', get_template_directory_uri() . '/assets/js/imagesloaded.pkgd.min.js', ['jquery'], null, false);

  //footer scripts    
    wp_enqueue_script('main-js', get_template_directory_uri() . '/assets/js/main.js', ['jquery'], null, true);

}
add_action('wp_enqueue_scripts', __NAMESPACE__ . '\\assets', 100);
</code></pre>

<p>So in my main.js I get an error in my console and it says </p>

<blockquote>
  <p>Uncaught TypeError: $ is not a function (on the $(document).ready line)</p>
</blockquote>

<p>I have no idea what's causing this error, since the scripts are being loaded.</p>