i'm making use of bootstrap datepicker 1.4.0
https://github.com/eternicode/bootstrap-datepicker
what im trying block out days, comes in via string.
<input type="text" name="date" class="date-selector" data-dates-disabled="1,3,5> $("input.date-selector").datepicker({format: 'dd/mm/yyyy', orientation : 'left', todayhighlight : true, autoclose: true, clearbtn: true}).on('changedate', function (ev) {$(this).datepicker('hide');}); by making use of data-dates-disabled attribute passing in string of days blocked out.
$("input.date-selector").datepicker({format: 'dd/mm/yyyy', orientation : 'left', todayhighlight : true, autoclose: true, clearbtn: true, datesdisabled: $(this).attr('data-dates-disabled')}).on('changedate', function (ev) {$(this).datepicker('hide');});
try : check date on onselect event of datepicker , make empty if date selected data-date-disabled values
$("input.date-selector").datepicker({ format: 'dd/mm/yyyy', orientation : 'left', todayhighlight : true, autoclose: true, clearbtn: true, datesdisabled: $(this).attr('data-dates-disabled'), onselect : function(){ var datetodisable = $(this).attr('data-dates-disabled').split(','); var date = parseint($(this).val().split('/')[1]); if(datetodisable.indexof(date.tostring())!=-1) $(this).val(''); } }).on('changedate', function (ev) {$(this).datepicker('hide');});
Comments
Post a Comment