ondragenter event

Fires on the target element when the user drags the object to a valid drop target.


HTML Attribute <element ondragenter = "handler(event)">
Event Property object.ondragenter = handler;
attachEvent Method object.attachEvent("ondragenter", handler)
addEventListener Method object.addEventListener("dragenter", handler, useCapture)

Event information

Synchronous No
Bubbles Yes
Cancelable Yes

Event handler parameters

  • pEvtObj [in]
    Type: [IHTMLEventObj](aa703876(v=vs.85).md)

Standards information

There are no standards that apply here.


You can handle the HTMLElementEvents2::ondragenter event on the source or on the target object. Of the target events, it is the first to fire during a drag operation. Target events use the IHTMLDataTransfer::getData method to stipulate which data and data formats to retrieve. The list of drag-and-drop target events includes:

When scripting custom functionality, use the IHTMLEventObj::returnValue property to disable the default action.

Calls the associated event handler.

To invoke this event, do one of the following:

  • Drag the selection over a valid drop target within the client.
  • Drag the selection to a valid drop target within another window.

See also

About DHTML Data Transfer