Here it is my dragstart:
dragstart: function(e) {
$(this).css('opacity', '0.5');
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('application/json', {
id: $(this).attr('id'),
header: $('header', this).text()
});
},
I would like to pass some informations such id and text. My drop is:
drop: function(e) {
var data = e.dataTransfer.getData('application/json');
alert(data);
$(this).attr('id', data.id);
$('header', this).text(data.header);
},
But data is undefined, I can't access to my data. Is it the right way?
Thank's!