Brett Gregson
Brett Gregson

Reputation: 5913

jQuery UI draggable snap to grid, select element being snapped to?

I am using jQuery UI's draggable and droppable The draggable elements are being set to snap to elements with a specific class

When the element is dropped, how do I select the element that is was be snapped to? I can't seem to find anything in the documnetation Thanks

Upvotes: 1

Views: 1480

Answers (1)

Wesley
Wesley

Reputation: 5621

You have to catch the STOP event within the jQuery UI events list found here:

http://jqueryui.com/demos/draggable/#events

Example:

$( ".selector" ).draggable({
   stop: function(event, ui) { $(this).parent()//you got it from here }
});

Upvotes: 1

Related Questions