Hi I have 2 droppable divs and when a drag is dropped on either one of them, i'm trying to get the id of that drop element. It's always returning the id of the first drop element in the DOM.
$('#albumImgs li').draggable({
containment: '#content',
scrollSensitivity: 60,
revert: 'invalid',
cursor: 'move'
});
$('.dropContainerClosed').droppable({
accept: '#albumImgs li',
activeClass: 'dropContainerOpen',
drop: function(event, ui) {
var file = $(ui.draggable.find('img'));
var fileName = file.attr('alt');
var albumName = $('div.dropContainerClosed').attr('id');
console.log("fileName = "+fileName);
console.log("albumName = "+albumName);//always returns the first div.dropContainerClosed id in the DOM
if(albumName != undefined) {
$.post('addImage.php', {filen: fileName, albumn: albumName},
function(data) {
//do something here
}, 'json');
} else {
$.post('firstImage.php', {filen: fileName, albumn: albumName},
function(data) {
//do something here
}, 'json');
}
}
});