W3cubDocs

/Web APIs

Document: dragenter event

The dragenter event is fired when a dragged element or text selection enters a valid drop target.

The target object is the immediate user selection (the element directly indicated by the user as the drop target), or the <body> element.

Bubbles Yes
Cancelable Yes
Default action Reject immediate user selection as potential target element.
Interface DragEvent
Event handler property ondragenter

Examples

See the drag event for example code or this JSFiddle demo.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
dragenter_event
4
12
3.5
In Firefox, the dragenter event is fired twice when the dropzone is parent of draggable or draggable itself. See bug 804036 for details.
10
12
3.1
No
No
No
No
11
No

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/dragenter_event