javascript - Jquery date comparison -
hi iam using following code comparing entered date current date... 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 correctdate'); $('#<%=txtorderdate.clientid%>').val(''); } }); help me if knows it... advance thanks....
i tried copy code , works on 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 correctdate'); $(this).val(''); } }); i removed var usedate, , take note new dateparameter (y,m,d).
Comments
Post a Comment