JQuery goes to past date with the Date range
i'm using the date range with two textbox (fromDate,toDate), each one with icon trigger function . when i disable the "fromDate" the toDate can be goes to past dates ,i want to disable this and normally use like if no disabled textbox.
this is the jquery
- $(function () {
- $("#fromDate").datepicker({
- changeMonth: true,
- changeYear: true,
- numberOfMonths: 1,
- showOn: "button",
- buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif",
- buttonImageOnly: true,
- dateFormat: "dd-mm-yy",
- onClose: function (selectedDate) {
- $("#toDate").datepicker("option", "minDate", selectedDate);
- }
- });
- //check if disabled disable th datepiker icon also
- var disabled = $('#fromDate').attr('disabled');
- if (disabled == "disabled") {
- $("#fromDate").datepicker('disable');
- $("#toDate").datepicker("option", "minDate", $('#fromDate').val());
- } else {
- $("#fromDate").datepicker('enable');
- }
- $("#toDate").datepicker({
- defaultDate: new Date(),
- changeMonth: true,
- changeYear: true,
- numberOfMonths: 1,
- showOn: "button",
- buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif",
- buttonImageOnly: true,
- dateFormat: "dd-mm-yy",
- onClose: function (selectedDate) {
- $("#fromDate").datepicker("option", "maxDate", selectedDate);
- }
- });
- });
this is my html
- <input type="text" id="fromDate" name="fromDate" value="05-06-2013" disabled="disabled" />
- <input type="text" id="toDate" name="toDate" />
this is my code running with the issue link