HTML draggable Attribute

The HTML draggable attribute is an enumerated attribute and specifies whether the element is draggable or not (either with native browser behavior or the HTML Drag and Drop API). This attribute is commonly used in the drag and drop operations.

Images and links are draggable by default. For other elements, you must set the ondragstart event.

You can use this attribute on any HTML element. It is a part of the Global Attributes.

The draggable attribute can have the following values:

  • true: the element can be draggable.
  • false: the element cannot be draggable.
  • auto: drag is the default browser behavior.


<tag draggable="true|false|auto"></tag>

Example of the HTML draggable attribute:

    <title>Title of the document</title>
      #rectId {
        width: 350px;
        height: 70px;
        padding: 10px;
        border: 1px solid #aaaaaa;
      function allowDrop(event) {
      function drag(event) {
      function drop(event) {
        var data = event.dataTransfer.getData("Text");;
    <div id="rectId" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
    <p id="dragId" draggable="true" ondragstart="drag(event)">
      This is a draggable paragraph. Drag this item to the rectangle.

Practice Your Knowledge

What is true about the HTML draggable attribute?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?