The HTML ondragenter attribute is an event handler that triggers a script to execute when a draggable element or text selection leaves a valid drop target during a drag-and-drop operation.
Definition and Usage
➔ This indicates that a draggable item has crossed the boundary from a potential drop target.
➔ Typically used to provide visual feedback to the user, indicating that the draggable item hovering over the drop target has now moved outside of its boundaries.
➔ Events are fired on draggable items that will be dragged to the target.
- ondragstart - This is fired when the user begin to drag an element.
- ondrag - This is fired when an element is being dragged.
- ondragend - This is fired when the user has complete dragging the element.
➔ Events fired on the drop targets where the item can be dropped.
- ondragenter - This is fired when the dragged element enters the drop target.
- ondragover - This is fired when the dragged element is over the drop target.
- ondragleave - This is fired when the dragged element leaves the drop target.
- ondrop - This is fired when the dragged element is dropped on the drop target.
Applies to
This attribute can be used on the following element.
| Attribute | Element |
|---|---|
| ondragleave | All visible elements |