HTML ondrag Event Attribute (original) (raw)

Last Updated : 11 Jul, 2025

**The ondrag event attribute triggers when the element or text selection is being dragged in HTML. This event is very similar to the drag-and-drop event. This will triggered during a drag operation when an HTML element is being dragged.

**Syntax

**Supported Tags

It supports all HTML Elements.

**Attribute Value

This attribute contains a single value script that works when an element is dragged. It is supported by all HTML elements.

**Example: This example illustrates the implementation of the HTML ondrag Event Attribute.

HTML `

ondrag event attribute