/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: draggable

[this page | pdf | back links]

The HTML draggable attribute indicates whether an element is draggable.

 

Valid attribute values include:

 

Value

Description

draggable

Element is draggable

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Set using HTML:<br>
<p draggable="true">Text1</p>

<br><br>Set using JavaScript:<br>
<p id="x1">Text2</p>

<script>
document.getElementById("x1").draggable = true;
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile