HTML ondragenter Attribute

❮ HTML Attributes


<div ondragenter="myFunction(event)"></div>


The ondragenter attribute specifies the script to be run when an element has been dragged to a valid drop target.

Note: To make an element draggable, use the global HTML5 draggable attribute.

Tip: A links and images are draggable by default there is no need of draggable attribute.

Standard Syntax

<element ondragenter="script">

Browser Support


Applies to:

The ondragenter attribute can be used on the following element:

Element Attribute
All visible elements. ondragenter

Attribute Values

Value Description
script Specifies the script to be run on ondragenter
❮ HTML Attributes