HTML draggable Attribute

HTML draggable Attribute: This defines whether an element is draggable or not. Links and images are by default draggable. The draggable attribute is often used in the drag and drop operations.

HTML draggable Attribute

This attribute can be applied to all the HTML elements.

Attribute Value: It contains three value which is listed below:

true: This value represents the element is draggable.
false: This value represents the element is not draggable.
auto: This value represents the uses of the default browser.

Syntax: <element draggable = “true|false|auto”>

Browser Support

This attribute is supported by the following browsers:

  • Chrome – 4.0
  • Firefox – 3.5
  • Safari – 6.0
  • Opera – 12.0
  • Internet Explorer – 9.0

Example: for draggable attribute

#div1 {
  width: 350px;
  height: 70px;
  padding: 10px;
  border: 1px solid #aaaaaa;
function allowDrop(ev) {

function drag(ev) {
function drop(ev) {
  var data = ev.dataTransfer.getData("Text");;
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<p id="drag1" draggable="true" ondragstart="drag(event)">Drag this paragraph into the rectangle.</p>



HTML draggable attribute1


HTML draggable attribute