Hy,
I have this jquery code , what it does is saving in database (through ajax) the position of div in a database ,
but i don`t know how to get the id of div dragged , on the drop event
$().ready(function () {
$('.dragDiv').Drags({
handler: '.handler',
onMove: function (e) {
//$('.content').html('Div Position:(Left:' + e.pageX + ' ,Top:' + e.pageY + ')');
//$('.content').html(done);
},
onDrop: function (e) {
//$('.content').html('dropped!' + e.pageX);
$.ajax({
url: 'includes/scripts/data.php',
data: "top=" + e.pageX + "&left=" + e.pageY + ""
});
}
});
$('.dragDiv2').Drags({
handler: '.handler2',
zIndex: 200,
opacity: .9
});
});
Use this:
EDIT
If you would like to try this, you can try getting the id in the onDrag function using:
Verify that this is the correct id for the div, and if it is, this would be the recommended methodology.
EDIT
Good point ‘Shadow Wizard’
EDIT
If all the previous methods have failed, use the jQuery event target:
This should go into your
onDragmethod.