在1.4后增加了
jQuery.isEmptyObject({})
验证json数据是否为空。
用选择器选择的数据是否为空可这样判断:
$("#txtEndTime").length == 0,jquery无论如何都会返回一个jquery对象。
if ($("#txtBeginTime").length > 0 && $("#txtEndTime").length > 0) {
if (isdate2($("#txtBeginTime").val()) == false) {
alert("时间格式必须为2006-01-01 00:00:00,且在1899年与3000年之间");
return false;
} else if (isdate2($("#txtEndTime").val()) == false) {
alert("时间格式必须为2006-01-01 00:00:00,且在1899年与3000年之间");
return false;
}
}