dhtmlxCalendar + multiple input box show hide

I am using dhtmlxCalendar with the multiple input text in the same page. but whenever click the clicking on any such input text , its not closing its previous input calendars. below is the code sample have a look @ it.



var cal1,

cal2,

mCal,

mDCal,

newStyleSheet;

var dateFrom = null;

var dateTo = null;

window.onload = function() {

cal1 = new dhtmlxCalendarObject(‘sDate’);

cal1.setDateFormat("%m/%d/%Y");

cal1.draw();

cal1.hide();



cal2 = new dhtmlxCalendarObject(‘eDate’);

cal2.setDateFormat("%m/%d/%Y");

cal2.draw();

cal2.hide();



}











  • Start date



    Please enter a date

    REQUIRED













  • End date



    Please enter a date

    REQUIRED






  • You can try to use the following approach to hide a calendar when one clicks on an input of another calendar:


    document.getElementById(“sDate”).onmouseup = document.getElementById(“eDate”).onmouseup = closeAll;



    function closeAll(){
    cal1.hide();


    cal2.hide()
    }