That a button has to double click to make the form post?

1

It all arises that a user may be wrong to write a text in the input then I want to make the form post only when the user double-clicks the button.

    
asked by FuriosoJack 04.04.2017 в 19:57
source

3 answers

5

You can use the event dblclick() of jquery in the following way:

$("#id_del_boton").on('dblclick', function(e){

  alert("Hola");

});
    
answered by 04.04.2017 в 20:01
1

In addition to the dblclick event it is important to cancel the click event, one way to handle it could be the following:

$("#send").on('click dblclick', function(){
 if (event.type == "click")
  return false

// else
 return confirm("submit form?");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="send">send</button>
    
answered by 04.04.2017 в 20:36
0

Fabian Sierra's response complements it with

$("#guardarAprovado").on('dblclick', function(e){
    $("#datoss").submit();
});
    
answered by 04.04.2017 в 20:40