验证不适用于我的复选框列表。
<td style="background-color:#cbd5df">
<span id="DataList1_ctl01_CheckBoxList1" style="font-family: Trebuchet MS;background-color: #cbd5df">
<input id="DataList1_ctl01_CheckBoxList1_0" type="checkbox" name="DataList1$ctl01$CheckBoxList1$0" />
<label for="DataList1_ctl01_CheckBoxList1_0">Product A</label><br /><input id="DataList1_ctl01_CheckBoxList1_1"
type="checkbox" name="DataList1$ctl01$CheckBoxList1$1" /><label for="DataList1_ctl01_CheckBoxList1_1">Product B</label>
<br /><input id="DataList1_ctl01_CheckBoxList1_2" type="checkbox" name="DataList1$ctl01$CheckBoxList1$2" />
<label for="DataList1_ctl01_CheckBoxList1_2">Product c</label></span><br/><br/>
<span id="DataList1_ctl01_Labelx"></span>
</td>
接下来是JS:
<script type = "text/javascript">
function ValidateCBL(source, args) {
var cblist= $(source).parent().find("table[id$='DataList1_ctl01_CheckBoxList1']");
if (cblist.length==0 || cblist.find('input:checkbox:checked').length > 0)
{
args.IsValid = true;
}
else {args.IsValid = false;}
}
</script>
我做错了什么?