I am trying to validate if all items (radio buttons) are checked. The following code works, but as soon as I click on the alert-window, it pops up again. Using event.stopPropagation()
doesn't change anything. It is not waiting for the user to check the remaining items.
$(document).ready(function(){
$(document).on('submit','#formular',function(event){
$("input:radio").each(function() {
var val = $('input:radio[name=' + this.name + ']:checked').val();
if (val === undefined) {
alert("Not every item answered");
event.preventDefault();
}
});
});
});