jQuery UI Datepicker - Colour-coding dates in a calendar
I am using jQuery UI Datepicker in the conventional way for selecting dates. Now I also want to use it to display a calendar with some dates colour-coded according to certain characteristics.
The calendar is called on the page with
- <div id="calendar"></div>
and the script on the page (so far) is
- $(function() {
- $( "#calendar" ).datepicker({
- numberOfMonths: 4
- });
- });
The information about each date will come from a mySQL database. How can I put a different background colour on each date to show the different characteristic? Presumably I will be adding an extra class to something with CSS, a bit like this
- .open{background-color:yellow;}
- .closed{background-color:red:}
There will be 4 or 5 different background colours in total.
Obviously I need some more code in the script, but what?