Drag and Dropping - ID of original and new table cell
Hi,
I am trying to do a table, each cell with a <div> inside it. The <div>
in each cell is droppable into a new cell. I need to know the ID of
the original TD and the new TD which the div has moved to. So far I
have:
$("#theTable td div").draggable({
containment: "#theTable",
cursor: 'pointer',
zIndex: 130
});
$("#theTable td").droppable({
accept: "div",
drop: function(e, ui) {
// Cell moving from
fromCell = $(e).parent("td").attr("id");
// New cell
newCell = $(this).attr("id");
$("#the-movement b").text(fromCell + "-" + newCell);
}
});
This gives a result in #the-movement span of "undefined-[correct
square]". Any help please? Thanks.