jquery ui get id of child element of dragged element, when dropped
Posted
by Catfish
on Stack Overflow
See other posts from Stack Overflow
or by Catfish
Published on 2010-03-12T05:20:08Z
Indexed on
2010/03/12
5:27 UTC
Read the original article
Hit count: 430
I've read through many of the drag and drop threads on SO and i haven't found one that tells me how to get the child element id of the dragged element, when the dragged element is dropped.
For example if you have
<div id='drag'>
<img id="something"/>//how do i get this id when #drag is dropped?
</div>
<div id='drop'>
</div>
and the js
$('#drag').draggable({
containment: '#content',
scrollSensitivity: 60,
revert: 'invalid',
cursor: 'move'
});
$('#drop').droppable({
accept: '#albumImgs li',
activeClass: 'dropContainerOpen',
drop: function(event, ui) {
var fileName = $(ui.draggable.attr('alt'));
console.log(fileName);
}
});
© Stack Overflow or respective owner