Reputation: 24
If is not blocking the execution of else statement. Help plase!
function checarZero() {
$(".ps-form-entry--progressbar").each(function() {
var valorPerc = $(this).val();
if (parseFloat(valorPerc) === 0) {
psLib.NotifyShowHide(
'alert:Você não distribuiu a renda vitalícia.');
event.preventDefault();
} else {
$("#btn-continuar").fadeIn("fast");
}
});
}
Upvotes: 0
Views: 465
Reputation: 8607
That's because event
is undefined.
Given the snippet you provided is your code, you should see an error in your JS console.
The event
variable should be passed into checarZero
function, for it to be cancelled.
From the snippet, it's hard to say what event you're looking for, if you just want to stop the execution of .each
loop you must return false;
Upvotes: 1