Advertisement
Home Open Editor ❯

HTML ondragstart Attribute

Example

<p draggable="true" ondragstart="myFunction(event)">Drag me!</p>

Meaning

The ondragstart attribute specifies the script to be run at the start of a drag operation.

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 ondragstart="script">


Applies to:

The ondragstart attribute can be used on the following element:

Element Attribute
All HTML elements ondragstart

Advertisement

Attribute Values

Value Description
script Specifies the script to be run on ondragstart
Home Open Editor ❯
Advertisement