jQuery actual validation with From date and to date validation.
1.
If from date is selected then to date will be
>= from date
2.
If to date selected first then from date will
be <= to date
$(document).ready(function
() {
$("#<%=txtCreateDtFrom.ClientID %>").prop('readonly',
true);
$("#<%=txtCreateDtTo.ClientID %>").prop('readonly',
true);
$("#<%=txtDeadlineFrom.ClientID %>").prop('readonly',
true);
$("#<%=txtDeadlineTo.ClientID %>").prop('readonly',
true);
$(".calendar-drop").datepicker({
changeMonth: true,
changeYear: true
});
$("#<%=txtCreateDtFrom.ClientID %>").datepicker({
changeMonth: true,
changeYear: true,
beforeShow: function () {
dt =
$("#<%=txtCreateDtTo.ClientID %>").datepicker('getDate');
return { maxDate: dt };
}
});
$("#<%=txtCreateDtTo.ClientID %>").datepicker({
changeMonth: true,
changeYear: true,
beforeShow: function () {
dt =
$("#<%=txtCreateDtFrom.ClientID %>").datepicker('getDate');
return { minDate: dt };
}
});
$("#<%=txtDeadlineFrom.ClientID
%>").datepicker({
changeMonth: true,
changeYear: true,
beforeShow: function () {
dt =
$("#<%=txtDeadlineTo.ClientID %>").datepicker('getDate');
return { maxDate: dt };
}
});
$("#<%=txtDeadlineTo.ClientID %>").datepicker({
changeMonth: true,
changeYear: true,
beforeShow: function () {
dt =
$("#<%=txtDeadlineFrom.ClientID %>").datepicker('getDate');
return { minDate: dt };
}
});
});