i'm using datePicker
in this way:
$("#dataStart").datepicker({
beforeShow: function () { $('#ui-datepicker-div').css('z-index',9999); },
dateFormat: 'mm/dd/yy'});
$("#dataEnd").datepicker({
beforeShow: function () { $('#ui-datepicker-div').css('z-index',9999); },
dateFormat: 'mm/dd/yy'});
I want to force select a date in future and not in the past, is there a possibility to do it? if so, is possible to change in a dynamic way for the second datepicker, so if user select a date, in the second field he has to select a date next to the first selected. i hope i ask as well my question :) Thanks all!
minDate:1
should only allow dates tomorrow and onward. Then add an onselect
to restrict dataEnd
:
$("#dataStart").datepicker({
minDate: 1,
onSelect: function(theDate) {
$("#dataEnd").datepicker('option', 'minDate', new Date(theDate));
},
beforeShow: function() {
$('#ui-datepicker-div').css('z-index', 9999);
},
dateFormat: 'mm/dd/yy'
});
Reference: http://blog.alagad.com/2009/04/20/playing-with-jquery-datepicker/
Example: http://jsfiddle.net/jtbowden/F39kt/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With