Calendar: Hide ALL open calendars

How can I close ALL open calendars at the same time?

I am using up to 20+ calendars on the same page and when I open a new one I want to first hide/close all currently opened ones, so that only the one I want to show is open.

Calendar creates a global array - dhtmlxCalendarObjects and places all calendars in it:

for(var i =0; i<dhtmlxCalendarObjects.length;i++)
dhtmlxCalendarObjects[i].hide();

Thank you Alexandra!

Hello,
I would like to use the funcionality that you have described, but I’m not sure where to place this piece of code. I would like to hide all other calendars when a user clicks the text input which a calendar is attached to. I can’t set an onclick function to the input as it will be overriden during the calendar’s initialization. I’d be grateful for a tip on that.
Regards,
Sara

Hello Sara,

possibly you could use one calendar for all inputs. Please see the sample in calendar package:

dhtmlxCalendar/samples/01_initialization/10_calendar_attach_to_several_inputs.html

Thank you Alexandra, that works perfectly!