admin管理员组文章数量:1305382
Hi iam using the following code for paring the entered date with current date... But it is not working...
$('#<%=txtOrderDate.ClientID%>').change(function() {
var date = $('#<%=txtOrderDate.ClientID%>').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');
$('#<%=txtOrderDate.ClientID%>').val('');
}
});
Help me if anybody knows it... Advance thanks....
Hi iam using the following code for paring the entered date with current date... But it is not working...
$('#<%=txtOrderDate.ClientID%>').change(function() {
var date = $('#<%=txtOrderDate.ClientID%>').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');
$('#<%=txtOrderDate.ClientID%>').val('');
}
});
Help me if anybody knows it... Advance thanks....
Share Improve this question asked Dec 3, 2010 at 9:56 Nithesh NarayananNithesh Narayanan 11.8k35 gold badges101 silver badges140 bronze badges 1- 1 Exactly how is it not working? Is there an error message? How is the result different from what you expect? – David Miller Commented Dec 3, 2010 at 10:53
1 Answer
Reset to default 7i tried to copy your code and this works on my machine
$('#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('');
}
});
i removed the var from the useDate, and take note that new Dateparameter is (y,m,d).
本文标签: javascriptJquery date comparisonStack Overflow
版权声明:本文标题:javascript - Jquery date comparison - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741804402a2398412.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论