title: Reset/clear modal form on closing it
body: <p>I am trying to reset/clear my form inside the modal when I close it but this does not seem to work. This is my code:</p>
  
  <pre><code> &lt;a href = "#myModal" data-toggle="modal" data-target = "#edit-modal"&gt;&lt;span class = "glyphicon glyphicon-tag"&gt;&lt;/span&gt;&lt;/a&gt;
  &lt;div id="edit-modal" class="modal fade"  role="dialog" aria-hidden="true"&gt;
  &lt;div class="modal-dialog"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
        &lt;h4 class="modal-title"&gt;Add tags&lt;/h4&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
     &lt;form name = "form2" id = "form2" method = "post" action = "{% url 'savetag' %}" class = "form-inline"&gt;
      {% csrf_token %}
      &lt;div class = "form-group"&gt;
      &lt;input name = "tag"  id = "tag" required&gt;
      &lt;button type = "submit" class = "btn btn-danger"&gt;Save&lt;/button&gt;
      &lt;/div&gt;
      &lt;/form&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  
  
   &lt;script&gt;
      $('#edit-modal').on('hidden.bs.modal', function(e){
             $(this).find('form2')[0].reset();           
      });
      &lt;/script&gt;
  </code></pre>
  
  <p>Can someone guide me on what needs to be corrected.Thanks
  This is fiddle link </p>
  
  <p><a href="https://jsfiddle.net/qzzu2vqs/4/" rel="nofollow noreferrer">https://jsfiddle.net/qzzu2vqs/4/</a></p>