Home  >  Article  >  Web Front-end  >  Determine whether checkboxlist (.net control client ID) is selected in js_javascript skills

Determine whether checkboxlist (.net control client ID) is selected in js_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:37:351138browse

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:

Copy the code The code 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;
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn