Validation with Parsley and Modal window
<p>I have a problem and can not solve. I have a button that when you click on it displays a message to the user confirmation, it happens that before opening this modal I would like to validate that all fields are filled.</p>

<p>For validation I am using the lib <strong>Parsley</strong></p>

<p>If I only use simple button as below the validation is successful.</p>

<pre><code>&lt;button class="btn btn-primary" type="submit"&gt;Submit&lt;/button&gt;
</code></pre>

<p>But if you use the button that calls the modal can not use the validator before.</p>

<pre><code>&lt;button data-toggle="modal" data-target="#md-default" type="button" id="postar" class="btn btn-info btn-lg"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; &lt;b&gt;Enviar&lt;/b&gt;&lt;/button&gt;


 &lt;!-- Modal --&gt;
                          &lt;div class="modal fade" id="md-default" tabindex="-1" role="dialog"&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" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                                   &lt;/div&gt;
                                   &lt;div class="modal-body"&gt;
                                      &lt;div class="text-center"&gt;
                                         &lt;div class="i-circle primary"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt;&lt;/div&gt;
                                         &lt;div class="confirmacao" id="confirmacao"&gt;
                                            &lt;h4&gt;Confirma o envio do Push?&lt;/h4&gt;
                                         &lt;/div&gt;
                                         &lt;div class="resp"&gt;&lt;/div&gt;
                                         &lt;p&gt;&lt;/p&gt;
                                      &lt;/div&gt;
                                   &lt;/div&gt;
                                   &lt;div class="modal-footer"&gt;
                                      &lt;button type="button" class="btn btn-default btn-flat" data-dismiss="modal" id="cancelButton" &gt;Cancelar&lt;/button&gt;
                                      &lt;button type="submit" class="btn btn-primary btn-flat enviar" id="submitButton" &gt;Sim&lt;/button&gt;
                                      &lt;button type="button" style="display: none" class="btn btn-default btn-flat" data-dismiss="modal" id = "closeButton"&gt;Fechar&lt;/button&gt;
                                   &lt;/div&gt;
                                &lt;/div&gt;
                                &lt;!-- /.modal-content --&gt;
                             &lt;/div&gt;
                             &lt;!-- /.modal-dialog --&gt;
                          &lt;/div&gt;


&lt;!-- /.modal --&gt;
</code></pre>