title: Jinja, loading javascript script
body: <p>I have a script that overrides autocomplete</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function() {
  $("#autocomplete").autocomplete({
      source:function(request, response) {
          $.getJSON("{{url_for('user.autocomplete')}}",{
              search: request.term, 
          }, function(data) {
              response(data.results); 
          });
      },
      minLength: 2,
      }
  });
  })
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Later in my code i have the following form</p>
  
  <pre><code>&lt;form method=post action="{{ url_for('user.merge_user')}}"&gt;
      &lt;input name="autocomplete" type="text" id="autocomplete" class="form-control input-lg", length="20"/&gt;
      {{ form.user_name(id="autocomplete", class="form-control input-lg") }}
      &lt;input class="btn btn-default" type=submit value=Register&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The HTML input uses the script as desired but the Jinja version uses the default autocomplete method.  How can I get it to use the script?</p>