Check documentation for the latest version of dhtmlxSuite Object Constructor DHTMLX Docs

Object Constructor

There are several ways of Calendar initialization on a page. The most common of them are presented below:

  • initializing in an HTML container
<div id="box" style="position:relative;height:250px;"></div>
 
<script>
var myCalendar = new dhtmlXCalendarObject("box");
myCalendar.show();
</script>
  • attaching calendar to an input
<input type="text" id="calendar">
<input type="text" id="calendar2">
 
<script>
var myCalendar = new dhtmlXCalendarObject(["calendar","calendar2"]);
</script>
  • using calendar inside of Form
formData = [
    {type:"calendar", label:"Start Date", skin:"dhx_skyblue", enableTime:true,
        dateFormat:"%Y-%m-%d %H:%i"},
    {type:"calendar", label: "End Date",  skin:"dhx_skyblue", 
        dateFormat: "%Y-%m-%d"}
];
myForm = new dhtmlXForm("myForm", formData);

To learn about other ways of initialization and get more detailed information, read the chapter "Initialization".

Back to top