I want to get dragged id when i dropped to the certain div
Drag <ul id="demo" >
<li id="1" ></li>
<li id="2" ></li>
<li id="3" ></li>
</ul>
<div class="drop"> drop here!! </div>
JQUERY
$(".drop").droppable({
drop: function(event, ui) {
// i need to get dragged id (note:able to drag multiple ids)
1,2,3..
}
});
Please help me out!! Thnks
As they says in jQuery UI dropable doc
All callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):
ui.draggable - current draggable element, a jQuery object.
ui.helper - current draggable helper, a jQuery object
ui.position - current position of the draggable helper { top: , left: }
ui.offset - current absolute position of the draggable helper { top: , left: }
ui.draggable
is the element being dropped as a jQuery object
.
So You can get the ID using ui.draggable.prop('id')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With