Hi,
I use draggable/droppable JQuery feature as follows
div.container {
height:400px;
}
<div class="container" id="source">
<div id="0">Item 0</div>
<div id="1">Item 1</div>
<div id="2">Item 2</div>
</div>
<div class="container" id="target"></div>
$("#source div").draggable({
helper:"clone",
revert:"invalid"
});
I would like to know whether is possible inject an object inside a context of a draggable object. Something like
var contextualObject = {"property":"value"};
$("#source div").draggable({
helper:"clone",
revert:"invalid",
injected:contextualObject
});
So in target container i could use something like (Notice second alert statement)
$("#target").droppable({
accept:"#source div",
tolerance: "fit",
drop:function(e, ui) {
alert("You have dropped id " + $(this).attr("id"));
alert("Its contextual value is: " + $(this).draggable("option", "injected.property"));
}});
How can i do it ?
regards,