draggable
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.
Warning: 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 |
---|
HTML Standard (HTML) # the-draggable-attribute |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
draggable |
Yes |
12 |
2 |
Yes |
12 |
Yes |
Yes |
Yes |
4 |
Yes |
Yes |
Yes |
See also
- All global attributes.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable