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.
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.
You can use the event dblclick()
of jquery in the following way:
$("#id_del_boton").on('dblclick', function(e){
alert("Hola");
});
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>
Fabian Sierra's response complements it with
$("#guardarAprovado").on('dblclick', function(e){
$("#datoss").submit();
});