I have an interactive calendar, and to add new notes by clicking on the day I extract the format date of that day and store it in a variable, all right up there, the problem is that to be displayed in the Calendar as an "active note" I must add it to a predefined object called "events".
An example is the following:
events = { "2017-06-30": {"number": 5, } };
$('.responsive-calendar').responsiveCalendar('edit', events);
In the calendar, the box of June 30, 2017 already has a new event, with 5 tasks given by the "number". As seen in the image
Now with this code I program it with what was said at the beginning, nothing happens, place alerts with the values of the object "events":
$(".responsive-calendar").responsiveCalendar({
onDayClick: function(events) {
var keyy = $(this).data('year')+'-'+addLeadingZero($(this).data('month'))+'-'+addLeadingZero($(this).data('day'));
events = { keyy : {"number": 5}};
for (var keey in events) {
if (events.hasOwnProperty(keey)) {
alert(keey); // variable
alert(events[keey]); // opcionales
}
$('.responsive-calendar').responsiveCalendar('edit', events);
When doing the verification, it appears to me that the object is taking the name of the variable "keey" but not its value.
How do I resolve this?