Reputation: 432
I tried to update an fullcalendar event with updateEvent but only the first time works, the second time that I try to use this, it updates the first event too. Thanks and sorry for my english.
eventClick: function(event,element) {
$('#ventanaEdit').removeClass('editarInv').addClass('editar');
$('#titulo').val(event.title)
$('#color').val(event.backgroundColor)
$('#titulo').focus();
$('#editar').click(function(){
var titulo= document.getElementById('titulo').value;
var color = document.form1[2].value;
event.title= titulo;
event.backgroundColor= color;
$('#calendar').fullCalendar('updateEvent', event);
$('#formulario').each (function(){
this.reset();
});
$('#ventanaEdit').removeClass('editar').addClass('editarInv');
});
Upvotes: 0
Views: 416
Reputation: 26730
You're binding a new click event handler to #editar every time a click on an event on the calendar occurs. That way, previously edited events get updated too, when you click on #editar. You need to unbind the old event handler first:
// ...
$('#editar').unbind('click').click(function() {
// ...
Upvotes: 1