How could I make this code dry?
$("#btnSubmitToCheckOut").click(function(event) {
var isSelected = [];
$(".age_agree :checkbox").each(function() {
if ($(this).is(":checked")) {
isSelected.push("true");
} else {
isSelected.push("false");
}
});
if ($.inArray("false", isSelected) < 0) {
$(this).parents('form').submit();
} else {
alert('Please accept all the Terms and Conditions');
}
});