Jquery日期比较

嗨iam使用以下代码将输入的日期与当前日期进行比较……但它不起作用……

$('#').change(function() { var date = $('#').val(); var arrDate = date.split("/"); var today = new Date(); var useDate = new Date(arrDate[2], arrDate[1] - 1, arrDate[0]); if (useDate > today) { alert('Please Enter the correctDate'); $('#').val(''); } }); 

如果有人知道的话请帮帮我……谢谢….

我试图复制你的代码,这适用于我的机器

  $('#txtbox').change(function() { var date = $(this).val(); var arrDate = date.split("/"); var today = new Date(); useDate = new Date(arrDate[2], arrDate[1] -1, arrDate[0]); if (useDate > today) { alert('Please Enter the correctDate'); $(this).val(''); } }); 

我从useDate中删除了var,并注意到新的Dateparameter是(y,m,d)。