It is posible cancel form submit if i click Cancel?
$("#button").click(function(){
confirm ("Are you ready?");
$("#form")[0].submit();
});
Now any (after OK and Cancel) time form are submited.
I try this logicly should work.
$("#button").click(function(){
confirm ($("#form")[0].submit(););
});
You can call event.preventDefault()
when you do not want form to get submitted.
$("#button").click(function(event){
if(!confirm ("your message"))
event.preventDefault();
});
event.preventDefault()
Description: If this method is called, the default action of the event will not be triggered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With