I\'m trying to catch the dragend event in JavaScript for a draggable DIV. The dragend event is not fired at all, why ? and how to solve this ? PS, I\'m using .draggable() me
In JavaScript and jQuery, when the user stops dragging the cursor, the event fired is: dragend
.
In jQuery UI, after calling .draggable();
, when the user stops dragging the cursor, the event fired then becomes: dragstop
. (Small demo showing that dragstop no longer works when .draggable() isn't called.)
Documentation...
JavaScript - dragend
: Searching google for this produces about 100,000 search results, so this is likely what you'll be using. Source: MDN Web Docs: Document: dragend Event
jQuery UI - dragstop
: Searching for "jQuery UI Dragstop" produces only 5,000 search results at Google as of August, 2020. I can barely find any mention of it, but it is there in the Official jQuery UI Documentation: Draggable Widget.
Try using dragstop
instead of dragend
.bind('dragstop', function(){ $("#divId").text("drag ended");});