title: How to use jQuery on Django Media Form
body: <p>i'm trying to inject extra javascript and jQuery on Django form through Media meta class.</p>
  <p>I return a form to the create.html template and rendered ok with js functions was executed but not jQuery functions.</p>
  <p>base.html for templates:</p>
  <pre><code>...
  {% block content %}
  {% endblock %}
  ...
  {% block javascript %}
    &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.min.js&quot; integrity=&quot;sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
    ...
    &lt;script type=&quot;text/javascript&quot;&gt;
      console.log('base.html js');
    &lt;/script&gt;
  {% endblock javascript %}
  </code></pre>
  <p>create.html:</p>
  <pre><code>{% extends &quot;base.html&quot; %}
  {% load static %}
  {% block javascript %}
    {{ block.super }}
    &lt;script type=&quot;text/javascript&quot;&gt;
      console.log('create.html js');
    &lt;/script&gt;
  {% endblock javascript %}
  {% block content %}
    {% if form %}
      {{ form.media }}
      {% include 'form.html' %}
    {% endif %}
  {% endblock content %}
  </code></pre>
  <p>form.html:</p>
  <pre><code>{% load static %}
  {% block javascript %}
    {{ block.super }}
    &lt;script type=&quot;text/javascript&quot;&gt;
      console.log('create.html js');
    &lt;/script&gt;
  {% endblock javascript %}
  ...
  {% for field in form %}
    {{ field|add_class:&quot;form-control&quot; }}
  {% endfor %}
  </code></pre>
  <p>forms.py:</p>
  <pre><code>class PlaceForm(forms.ModelForm):
    class Media:
      js = (
          'js/custom_tag_widget.js',
      )
  </code></pre>
  <p>custom_tag_widget.js:</p>
  <pre><code>$(document).ready( function() {
    console.log('form media js');
  });
  </code></pre>
  <p>I have this console output and appear an error:</p>
  <pre><code>form.html js
  ReferenceError: $ is not defined
  base.html js
  create.html js
  </code></pre>
  <p>Anybody could help me please ? Thanks in advance.</p>