title: Django OnClick Submit Button not showing confirmation pop-up
body: <p>I have a form in which I wanted to have the Submit button have a pop-up to ask the user if they are sure they want to submit the form with the options 'OK' and 'cancel'. This seemed to work on all of my other forms but this one is not. Instead of showing the pop-up and asking the user for confirmation, it just submits.</p>
  
  <p>Wondering if this might be because of a clash with the JS or another part of the logic in the form...</p>
  
  <p>Code:</p>
  
  <pre><code>{% extends "prod/page_base.html" %}
  
  {% load dajaxice_templatetags %}
  {% load static %}
  
  {% block title %}{{ edit_add }} product configuration{% endblock %}
  
  {% block dajax %}
      {% dajaxice_js_import %}
      &lt;script src="{% static 'dajax/jquery.dajax.core.js' %}"&gt;&lt;/script&gt;
  {% endblock %}
  
  {% block script %}
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
      if ($("#id_line").val() != "group1" &amp;&amp; $("#id_line").val() != "group2") {
          $("#group_fields").hide();
      }
      $("#id_line").click(function() {
          if ($("#id_line").val() != "group1" &amp;&amp; $("#id_line").val() != "group2") {
              $("#group_fields").hide();
          }
          else {
              $("#group_fields").show();
          }
      });
  });
  &lt;/script&gt;
  {{ form.media }}
  {% endblock %}
  
  {% block pagetitle %}{{ edit_add }} Product Configuration{% endblock %}
  
  {% block page_content %}
  
  {% if form.errors or formset.errors %}
  &lt;p class='error_note'&gt;&lt;strong&gt;Please correct the error{{ form.errors|pluralize }} below.&lt;/strong&gt;&lt;/p&gt;
  {% endif %}
  
      &lt;form class="edit" method="post" enctype="multipart/form-data"&gt;{% csrf_token %}
          {{ form.non_field_errors }}
          &lt;p&gt;
          {{ form.name.errors }}
          &lt;label for="id_name"&gt;Product Name:&lt;/label&gt;
          {{ form.name }}
          &lt;/p&gt;
          &lt;p&gt;
          {{ form.line.errors }}
          &lt;label for="id_line"&gt;Product Line:&lt;/label&gt;
          {{ form.line }}
          &lt;/p&gt;
          &lt;div id="group_fields"&gt;
          &lt;p&gt;
          {{ form.type.errors }}
          &lt;label for="id_type"&gt;Type:&lt;/label&gt;
          {{ form.type }}
          &lt;/p&gt;
          &lt;/div&gt;
          &lt;p&gt;
          {{ form.reason_for_change.errors }}
          &lt;label for="id_reason_for_change"&gt;Reason for change (mandatory):&lt;/label&gt;
          {{ form.reason_for_change }}
          &lt;/p&gt;
          &lt;input class="button" type="Submit" value="Commit changes" onclick="return confirm('Submit changes?')"&gt;
      &lt;/form&gt;
  
  {% endblock %}
  </code></pre>