I want to disable date_dis array from datepicker. I have tried following code.but when i press on txtdate it is showing whole the dates without disable.
<script language="javascript">
var date_dis = ["02-04-2016","03-04-2016","04-04-2016","05-04-2016","06-04-2016","07-04-2016","08-04-2016","09-04-2016","10-04-2016","11-04-2016","12-04-2016","14-04-2016","15-04-2016","17-04-2016","18-04-2016","19-04-2016","20-04-2016","21-04-2016","22-04-2016","23-04-2016","24-04-2016","25-04-2016","26-04-2016","27-04-2016","28-04-2016","29-04-2016","30-04-2016"];
$(document).ready(function () {
$('#txtdate').datepicker({
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('d-m-Y', date);
return [ date_dis.indexOf(string) == -1 ]
}
});
});
</script>
Use this dd-mm-yy
<script language="javascript">
var date_dis = ["02-04-2016","03-04-2016","04-04-2016","05-04-2016","06-04-2016","07-04-2016","08-04-2016","09-04-2016","10-04-2016","11-04-2016","12-04-2016","14-04-2016","15-04-2016","17-04-2016","18-04-2016","19-04-2016","20-04-2016","21-04-2016","22-04-2016","23-04-2016","24-04-2016","25-04-2016","26-04-2016","27-04-2016","28-04-2016","29-04-2016","30-04-2016"];
$(document).ready(function () {
$('#txtdate').datepicker({
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
return [ date_dis.indexOf(string) == -1 ]
}
});
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.