I have this Jquery code:
<script>
jQuery(document).ready(function(){
// Numero de click
var totalClicks = 0;
jQuery('#addpayment').submit(function(){
var dados = jQuery( this ).serialize();
// Verifica se o valor da variável totalClicks representa 3 clicks.
// Caso o número seja menor que 3 clicks, ignora esse trecho
if (totalClicks >= 2) {
alert("redirecionando");
windows.location......
return false;
}
}
//Soma o valor de totalClicks + 1
totalClicks++;
});
</script>
And this modal:
<form action="" method="post" id="addpayment" name="addpayment" class="form-
horizontal">
<!-- Modal -->
<div class="container">
<!-- Trigger the modal with a button -->
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h6 class="modal-title">Teste - Modal </h6>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<!--Fim Modal -->
I needed that after each click appeared the modal above, and in the third click, redirected the user to a page. The modal works, but the jquery (click) events do not.