views:

175

answers:

1

I have a simple application that users jquery-ui's draggable and droppable. In Firefox, it works perfectly. In Chrome, however, I'm having problems.

This is the code:

$(".cell").droppable({
        drop: function(event, ui) {
           var originalTarget = event.originalTarget;
           ...
         }
});

In Chrome the 'event' object is of type 'Object' (using Chrome Dev Kit), and event.originalTarget is 'undefined'. What am I doing wrong?

+2  A: 

To get the draggable element, use ui.draggable (this is a jQuery object). To get the droppable, use $(this). See the documentation on the drop event.

var draggable = ui.draggable[0];
var droppable = $(this)[0];
interjay
But target and originalTarget mean two different things - target is the where you are dragging TO, and originalTarget is WHAT you are dragging to it.
ripper234
@ripper234: I see. Updated my answer.
interjay
Thanks, I updated your question with the code I ended up using (array access [0] to get the actual element).
ripper234