Check documentation for the latest version of dhtmlxSuite attachObj DHTMLX Docs

attachObj

attaches a calendar to an input field

string|number attachObj(string|number|HTMLElement input);
inputstring|number|HTMLElementinput id, input DOM element
string|numberattachment id, you can use it for detachObj(id) later
Details

Any calendar instance can be attached to several inputs. You can do it using the following ways:


1) to pass the input id:

<input type="text" id="input1">
<input type="text" id="input2">
<input type="text" id="input3">
var myCalendar = new dhtmlXCalendarObject(["input1","input2"]);
var objId = myCalendar.attachObj("input3");


2) to pass the input DOM element:

<input type="text" id="input1">
<input type="text" id="input2">
<input type="text" id="input3">
var myCalendar = new dhtmlXCalendarObject(["input1","input2"]);
var inputObj = document.getElementById("input3");
myCalendar.attachObj(inputObj);


3) for an input with an icon:

<input type="text" id="input1">
<input type="text" id="input2">
<input type="text" id="input3">
<img id="icon" src="calendar.gif" border="0">
var myCalendar = new dhtmlXCalendarObject(["input1", "input2"]);
myCalendar.attachObj({input: "input3", button: "icon"});
Back to top