How to stop dragend's default behavior in drag and drop?


To stop dragend’s default behavior, you need to detect if the mouse is over the drop target where you want to drop.

This is what you should do only if you are hovering over my list − listContainer.insertBefore(source, myNode);

Use jQuery −

if ($(mylist).parent().find(":hover")) {
   listContainer.insertBefore(source, myNode);
}

Updated on: 25-Jun-2020

133 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements