我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

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

Specification Status Comment
HTML Living Standard
The definition of 'dragenter' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
dragenter eventChrome Full support 4Edge Full support 12Firefox Full support 3.5
Notes
Full support 3.5
Notes
Notes In Firefox, the dragenter event is fired twice when the dropzone is parent of draggable or draggable itself. See bug 804036 for details.
IE Full support 10Opera Full support 12Safari Full support 3.1WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS Full support 11Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.

See also