我陷入了这种循环的情况,当它被触发时我阻止它循环
这是我的代码
$("#shiftForm").on('submit',
function gvDDLValidation() {
var gvDetDDLs = $('#positionShiftGrid').find("input[name=shiftDay]");
$.each(gvDetDDLs, function () {
var duplicateExists = false;
var ddlShift = $("#ddlShiftDay option:selected").text();
var currVal = $(this).val();
gvDetDDLs.not(this).each(function (e) { <--- where i trigger error
e.preventDefault(); <--- where i trigger error
if (ddlShift == currVal) {
duplicateExists = true;
alert("Duplicate entry is not allowed");
$(this).focus();
return false;
}
});
});
return true;
});
谢谢 !