The draggable global attribute is an enumerated attribute that indicates whether the element can be dragged, either with native browser behavior or the HTML Drag and Drop API.
draggable
can have the following values:
true
: the element can be dragged.false
: the element cannot be dragged.
This attribute is enumerated and not Boolean. A value of true
or false
is mandatory, and shorthand like <img draggable>
is forbidden. The correct usage is <img draggable="false">
.
If this attribute is not set, its default value is auto
, which means drag behavior is the default browser behavior: only text selections, images, and links can be dragged. For other elements, the event ondragstart
must be set for drag and drop to work, as shown in this comprehensive example.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'draggable' in that specification. |
Living Standard | No change from latest snapshot, HTML 5.1 |
HTML 5.2 The definition of 'draggable' in that specification. |
Recommendation | No change |
HTML 5.1 The definition of 'draggable' in that specification. |
Recommendation | Snapshot of HTML Living Standard, initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
draggable | Chrome Full support Yes | Edge Full support 12 | Firefox Full support 2 | IE Full support Yes | Opera Full support 12 | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
See also
- All global attributes.