Disable refresh on button in modal
<p>I have a problems with my button in my modal. On this button I have put a <code>onclick</code>, but the problems is when a click on this one <code>mouse</code> or <code>enter</code>, the page refresh.</p>

<p>That's I want it's to may click on <code>ENTER</code> and my page do my function <code>connexion()</code> does not refresh, because a make a AJAX code inside.</p>

<p>This is my modal code:</p>

<pre><code>&lt;div class="modal fade" id="myModalLogin" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;

      &lt;!-- Modal content--&gt;
     &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal"&gt;&lt;span aria-hidden="true"&gt;×&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;&lt;/button&gt;
              &lt;h4 class="modal-title" id="myModalLabel"&gt;Se connecter&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;div id='wellconnexion' class="well"&gt;


                          &lt;h1 id="TitleHistoriqueconnnexion" class="text-center"&gt;Se connecter&lt;/h1&gt;
                          &lt;br&gt;

                           &lt;h4 id="ContentHistorique1"&gt;&lt;/h4&gt;

                          &lt;div id='contentconnexion' class="contentconnexion"&gt;
                           &lt;form &gt;
                             &lt;div class="form-group formmarginleft"&gt;
                                &lt;input  name="user_login" id="user_login" type="text" placeholder="Identifiant" class="form-control"&gt;
                             &lt;/div&gt;
                             &lt;div class="form-group formmarginleft"&gt;
                                 &lt;input name="user_password" id="user_password" type="password"  placeholder="Mot de passe" class="form-control"&gt;
                            &lt;/div&gt;
                          &lt;div class="row"&gt;
                             &lt;div class="col-12-xs text-center"&gt;
                             &lt;button id="validerlogin" onclick="connexion()" value="Se connecter" class="btn btn-primary"&gt;Se connecter&lt;/button&gt;
                             &lt;div data-dismiss="modal" class="btn btn-warning"&gt;Fermer&lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;/form&gt;

                        &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
</code></pre>