When submitting content to be added or modified, the key data needs to be checked. How to determine whether the checkboxlist has options in js?
The specific operation is as follows:
var CheckBox = document. getElementById("<%=cblWeek.ClientID %>").getElementsByTagName("INPUT");
if (CheckBox != undefined) {
var i = 0;
var j = 0;
for (i = 0; i < CheckBox.length; i ) {
if (CheckBox[i].checked) {
j = 1;
}
}
if (j == 0) {
alert("Please select a day of the week!");
return false;
}
}