title: "Javascript Error "Uncaught ReferenceError: selectMove is not defined"
body: <p>I keep getting this error in the below code on the last script line in my handlebars file "Javascript Error "Uncaught ReferenceError: selectMove is not defined"</p>
  
  <p>Here is my update-pokemon.handlebars rendered from the console.</p>
  
  <pre><code>       &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Pokemon Database&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
      &lt;script src="https://maxcdn.bootstrapcdn.com/boostrap/3.3.7/js/bootstrap.min.js&gt;&lt;/script&gt;
      &lt;script src="/static/selectMove.js"&gt;&lt;/script&gt;
      &lt;script src="/static/updatepokemon.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h1&gt; Update sadfasdf: &lt;/h1&gt;
  &lt;form id="update-pokemon" action="/pokemon" method="post"&gt;
      Pokemon Name: &lt;input type="text" name="pokemonname" value="sadfasdf"&gt;&lt;br&gt;
      Evolution Level: &lt;input type="text" name="evolutionlevel" value="0"&gt;&lt;br&gt;
      Primary Move: &lt;select name="movename" id="move-selector"&gt;
          &lt;option value="1"&gt;Vine Whip&lt;/option&gt;
          &lt;option value="2"&gt;Razor Leaf&lt;/option&gt;
          &lt;option value="3"&gt;Solar Beam&lt;/option&gt;
          &lt;option value="4"&gt;Ember&lt;/option&gt;
          &lt;option value="5"&gt;Flame Burst&lt;/option&gt;
          &lt;option value="6"&gt;Flamethrower&lt;/option&gt;
          &lt;option value="7"&gt;Bubble&lt;/option&gt;
          &lt;option value="8"&gt;Water Gun&lt;/option&gt;
          &lt;option value="9"&gt;Hydro Pump&lt;/option&gt;
          &lt;option value="10"&gt;String Shot&lt;/option&gt;
          &lt;/select&gt;&lt;br&gt;
          &lt;/form&gt;
      &lt;button onclick="updatePokemon(13)"&gt;Update&lt;/button&gt;
      &lt;script&gt;selectMove(1);&lt;/script&gt; 
  &lt;/body&gt;
  </code></pre>
  
  <p>I think it may relate to the selectMove.js file that contains the selectMove function, which is below here</p>
  
  <pre><code>function selectMove(id) {
          $("#move-selector").val(pokemonid);
  }
  </code></pre>
  
  <p>Also here is my updatepokemon file </p>
  
  <pre><code>function updatePokemon(id) {
          $.ajax({
                  url: '/pokemon/' + id,
                  type: 'PUT',
                  data: $('#update-pokemon').serialize(),
                  success: function(result) {
                    window.location.replace("./");
                  }
          })
  };
  </code></pre>
  
  <p>The first file is my handlebars file in my views directory, and the second is my selectMove.js located in the public directory.</p>
  
  <p>EDIT - Here is my handlebars code </p>
  
  <pre><code>&lt;h1&gt; Update {{pokemon.pokemonname}}: &lt;/h1&gt;
  &lt;form id="update-pokemon" action="/pokemon" method="post"&gt;
          Pokemon Name: &lt;input type="text" name="pokemonname" value="{{pokemon.pokemonname}}"&gt;&lt;br&gt;
          Evolution Level: &lt;input type="text" name="evolutionlevel" value="{{pokemon.evolutionlevel}}"&gt;&lt;br&gt;
          Primary Move: &lt;select name="movename" id="move-selector"&gt;
                  {{#each move}}
                  &lt;option value="{{primarymoveid}}"&gt;{{primarymovename}}&lt;/option&gt;
                  {{/each}}
          &lt;/select&gt;&lt;br&gt;
                  &lt;/form&gt;
          &lt;button onclick="updatePokemon({{pokemon.pokemonid}})"&gt;Update&lt;/button&gt;
          &lt;script&gt;$(function() {selectMove({{pokemon.movename}})});&lt;/script&gt;
  </code></pre>