判断HTML中的checkbox是否被选中

      //合法性验证
function checkValidity() {
var userNameCheck = $("#userNameCheck").attr('checked');
var dateCheck = $("#dateCheck").attr('checked');
var descCheck = $("#descCheck").attr('checked');
if (!userNameCheck && !dateCheck && !descCheck) {
alert("至少要勾选一个");
return false;
}
return true;
}
    var checkUserName = $("#checkUserName").is(":checked");
var checkOperateTime = $("#checkOperateTime").is(":checked");
var checkdescriptionInclude = $("#checkdescriptionInclude").is(":checked");
if (!checkUserName && !checkOperateTime && !checkdescriptionInclude) {
alert("至少选择一种条件查询");
return;
}
上一篇:C#编程简短总结


下一篇:iOS逆向开发(8):微信自动添加好友