Reputation: 28783
I have a function called saveSmilies which accepts two parameters: the dragged element id and the dropped element id.
I'm trying to do this like:
$('.draggable').draggable({
revert: true,
drop: function() {
$dropped = $(this);
},
stop: function() {
quiz1.saveSmilies($(this).attr('id'), $dropped);
}
});
But it doesn't work... Am I doing this completely wrong? Or just a typo somewhere?
So basically If I dragged an element with an id of 'box1' and dropped it on an element with an id of 'box2' then it would do the following: quiz1.saveSmilies('box1','box2');
Upvotes: 1
Views: 254
Reputation: 61793
This should work:
drop: function(ev, ui) {
var draggedID = ui.draggable.attr("id");
var droppedID = $(this).attr("id");
}
Upvotes: 1