JavaScript: jQuery Datepicker - simple highlighting of specific days, who can help? (source inside)
Posted
by Klicker.eu
on Stack Overflow
See other posts from Stack Overflow
or by Klicker.eu
Published on 2010-04-29T06:33:16Z
Indexed on
2010/04/29
6:37 UTC
Read the original article
Hit count: 403
Hi guys,
i want to use the Datepicker for highlighting specific dates. Here is my latest code:
<script type="text/javascript">
var dates = [30/04/2010, 01/05/2010];
$(function(){
$('#datepicker').datepicker({
numberOfMonths: [2,3],
dateFormat: 'dd/mm/yy',
beforeShowDay: highlightDays
});
function highlightDays(date) {
for (var i = 0; i < dates.length; i++) {
if (dates[i] == date) {
return [true, 'highlight'];
}
}
return [true, ''];
}
});
</script>
my CSS is:
#highlight, .highlight {
background-color: #cccccc;
}
Well the calendar comes up, but there is nothing highlighted. Where is the problem in my code? If anyone could help that would be great.
Another option/solution could be: disable all dates, but make available only dates in an array.
Thanks!
© Stack Overflow or respective owner