I use dhtmlxCalendar.
My task:
I have any number of INPUT tags with Calendar.
I choose date in ANY INPUT → this date set in ALL INPUT
It works if I print date myself.
But it doesn’t work if I choose date in dhtmlxCalendar
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="http://www.dhtmlx.com/docs/products/dhtmlxCalendar/codebase/dhtmlxcalendar.css">
<link rel="stylesheet" type="text/css" href="http://www.dhtmlx.com/docs/products/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
<script src="dhtmlxcalendar/dhtmlxcommon.js"></script>
<script src="dhtmlxcalendar/dhtmlxcalendar.js"></script>
<script src="dhtmlxcalendar/dhtmlxcalendar_double.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<script>
var myCalendar;
function doOnLoad() {
myCalendar = new dhtmlXCalendarObject(["calendar1","calendar2","calendar3"]);
myCalendar.setDate(new Date());
myCalendar.attachEvent("onClick", function() {
var element = document.getElementById('calendar1');
if( window.KeyEvent ) // Для FF
{
var o = document.createEvent('KeyEvents');
o.initKeyEvent( 'input', true, true, window, false, false, false, false, 13, 0 );
}
else // Для остальных браузеров
{
var o = document.createEvent('UIEvents');
o.initUIEvent( 'input', true, true, window, 1 );
o.keyCode = 13; // Указываем дополнительный параметр, так как initUIEvent его не принимает
}
element.dispatchEvent(o);
});
}
</script>
</head>
<body onload="doOnLoad();">
<input type="text" id="calendar1" ng-model='value1' />
<input type="text" id="calendar2" ng-model='value1' />
<input type="text" id="calendar3" ng-model='value1' />
</body>
<script>
</script>
</html>
Thanks.