Accept can be either a selector (usually a class) that describes elements that can be dragged into droppable, or a function that returns true if the object passed to it can be reset to the target.
Inconveniently, it seems that the accept function is triggered on every drag and drop event (start, stop, enter, leave), as well as when dragging along the edge of the page. If your receive function is quite large, you can put it in the drop / stop method and return if it is an invalid drop.
Alternatively, you can start with the accept function, determining whether the element has been dropped or discarded, and only a heavy lift in this case (otherwise return true, see note below).
Note: if accept returns false when dragging, it does not fire for any of the other events (except for dragging along the edge of the page).
source share