i am using bootstrap datepicker and i want to disabled previous dates but nothing will work.
this is what i tried so far
<input type="text" name="a" class="datepicker form-control"/>
$('.datepicker').datepicker({
format: 'mm-dd-yyyy',
minDate: new Date(),
maxDate: '+1y'
});
////////
$('.datepicker').datepicker({
format: 'mm-dd-yyyy',
startDate: '05-18-2016'
});
but nothing will work.
Try this:
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$('.datepicker').datepicker({
onRender: function(date) {
return date.valueOf() < now.valueOf() ? 'disabled' : '';
}
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments