Calendar onclick event add class to day number


I’m trying to add a class to the td of the day number when it is clicked. I.e. when a user clicks on a date in the calendar (I’m using v.2.1 build 90226) I want the background to turn red by adding a css class. Not just for one date but multiple dates.

I try to use this code but I can’t seem to itterate to the parent node/container for day number (I use jQuery):

mCal.attachEvent("onClick", mSelectedDate);
function mSelectedDate(date) {
  return true;

I’ve searched through the dhtmlxcalendar.js file and for example this.entObj.className gives me the class name of the calendar container but, as I mentioned, I need the td which holds the day number.

I managed to alter the clicked node through:

function mSelectedDate(date) {
  var td = this.activeCell;
  td.className="thismonth insensitive";
  return true;

To select multiple dates I need the cell instead of activeCell but cell is undefined in this function

As I now see that it is not possible to achieve my goals I have a feature request:

I want to be able to select and deselect one or more days.
When you click on a day the background turns red, click on that day again the background gets removed (to original state). I’ve seen this on several booking calendars.

Is this possible or, perhaps, could someone tell me how to achieve this by altering the dhtmlxcalendar.js file?