I have a button in ASP.NET webForm and even clicking cancel it sends the submit.
Example on Fiddle
$(function () {
$("[name='chk_IDDel']").change(function () {
var disabled = true;
$("[name='chk_IDDel']").each(function () {
if ($(this).is(':checked')) {
disabled = false;
if ($("input[name=chk_IDDel]:checked").length > 1) {
document.getElementById("<%= btn_Deletar.ClientID%>").value = 'Deletar imóveis';
}
else {
document.getElementById("<%= btn_Deletar.ClientID%>").value = 'Deletar imóvel'
}
}
});
$('#<%= btn_Deletar.ClientID%>').prop("disabled", disabled);
});
$("#<%= btn_Deletar.ClientID%>").click(function () {
var confirma = prompt("digite a palavra 'confirmar' para deletar", "");
if (confirma.toUpperCase() == "CONFIRMAR") {
document.all.submit();
}
else {
return false;
}
});
});
What am I doing wrong in JQUERY? I do not want you to send it by clicking cancel .. or do not type.