title: Enable/disable bootstrap popover when clicking a button
body: <p>In my Django project i have a very simple form containing just an input element and a submit button. Django form looks like this:</p>
  
  <pre><code>class CoopAnonymousEnterForm(forms.Form):
  
      nickname = forms.CharField(min_length=3, widget=forms.TextInput(attrs={
                                                          'class': 'form-control',
                                                          'placeholder': 'Enter nickname here',
                                                          'data-container': 'body',
                                                          'data-toggle': 'popover',
                                                          'data-placement': 'top',
                                                          'data-content': 'Enter at least three characters.',
                                                          }))
  </code></pre>
  
  <p>My page contains the following:</p>
  
  <pre><code>                &lt;form role="form" action="/anonymous_enter/" method="post"&gt;
                      {% csrf_token %}
                      &lt;div class="form-group"&gt;
                          &lt;!--&lt;input type="text" class="form-control" placeholder="Nickname"&gt;--&gt;
                          {{ anonymous_enter_form.nickname }}
                      &lt;/div&gt;
                      &lt;button id="anonymous-enter-button" type="submit" class="btn btn-default green"&gt;Start anonymously&lt;/button&gt;
                      &lt;button id="test-popover" type="button" class="btn btn-default"&gt;
                          Click!
                      &lt;/button&gt;
                  &lt;/form&gt;
  ...
  &lt;script&gt;
  
      $("#test-popover").on('click', function(){
          var anonymous_nickname = $("#id_nickname").val();
          if (anonymous_nickname.length &lt;= 2) {
              $('#id_nickname').popover();
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I would like this popover to appear only when user entered less than three characters into an input and clicked "test-popover" button. But the problem is that popover appears only when i click that input once again - not when the button is clicked.</p>
  
  <p>Could you show me the right way to do that please?</p>
  
  <p>Thanks in advance.</p>