HTML draggable Attribute Last Updated : 11 Jul, 2025 Comments Improve Suggest changes 2 Likes Like Report The HTML draggable attribute allows elements to be dragged and dropped within or between web pages. When set to "true", elements become draggable, facilitating interactive user experiences such as drag-and-drop functionality in web applications.Supported TagsIt supports all HTML elements. Syntax<element draggable = "true|false|auto">Attribute ValueThis attribute contains three values which are listed below: ValueDescriptiontrueElement is draggable.falseElement is not draggable.autoElement's draggable behavior follows browser default.HTML draggable Attribute ExamplesExample: In this example we creates a draggable element within a dropbox. The draggable attribute is set to true, enabling the element to be dragged and dropped. JavaScript functions handle drag and drop events. HTML <!DOCTYPE HTML> <html> <head> <title>draggable attribute</title> <style> .dropbox { width: 350px; height: 70px; padding: 10px; border: 1px solid #aaaaaa; } h1 { color: green; } </style> <script> function droppoint(event) { let data = event.dataTransfer.getData("Text"); event.target.appendChild(document.getElementById(data)); event.preventDefault(); } function allowDropOption(event) { event.preventDefault(); } function dragpoint(event) { event.dataTransfer.setData("Text", event.target.id); } </script> </head> <body> <center> <h1>GeeksforGeeks</h1> <h2>draggable attribute</h2> <div class="dropbox" ondrop="droppoint(event)" ondragover="allowDropOption(event)"> </div> <p id="drag1" draggable="true" ondragstart="dragpoint(event)"> GeeksforGeeks: A computer science portal for geeks </p> </center> </body> </html> Output: draggable attribute Example outputSupported BrowsersThe browser supported by draggable attribute are listed below:Google ChromeEdge Internet Explorer Firefox OperaSafari Create Quiz Comment V vijay_raj Follow 2 Improve V vijay_raj Follow 2 Improve Article Tags : Web Technologies HTML HTML-Attributes Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like