question about jQuery droppable/draggable.
Posted
by FALCONSEYE
on Stack Overflow
See other posts from Stack Overflow
or by FALCONSEYE
Published on 2010-05-07T15:48:23Z
Indexed on
2010/05/07
15:58 UTC
Read the original article
Hit count: 257
jQuery
I modified a sample photo manager application.
Instead of photos, I have employee records coming from a query. My version will let managers mark employees as on vacation, or at work. One of the things I did is to include employee ids like <a href="123">
. I get the ids from event.target. This works for the click function but not for the "droppable" function. This is what I have for the click function:
$('ul.gallery > li').click(function(ev) {
var $item = $(this);
var $unid = ev.target;
var $target = $(ev.target);
if ($target.is('a.ui-icon-suitcase')) {
deleteImage($item,$unid);
} else if ($target.is('a.ui-icon-arrowreturnthick-1-w')) {
recycleImage($item,$unid);
}
return false;
});
ev.target correctly gives the employee id.
when i try the same in one of the droppable functions:
$gallery.droppable({
accept: '#suitcase li',
activeClass: 'custom-state-active',
drop: function(ev, ui) {
var $unid = ev.target;
alert($unid);
recycleImage(ui.draggable,$unid);
}
});
the alert(ui) gives me [object]. What's in this object? How do i get the href out of this?
thanks
© Stack Overflow or respective owner