Saving data

Report a typo

Let's add the data to be saved. Add a method to the dragStartHandler function that allows you to use the entire dragged HTML element as data. Use event.target.outerHTML as the data.

If difficulties arise, refer to this article.

Write HTML and CSS code
<!DOCTYPE html>
<html>
<body>
<div id="draggable" draggable="true" ondragstart="dragStartHandler(event)">Drag me</div>

<script>
function dragStartHandler(event) {
event.dataTransfer.effectAllowed = "move";
// Add your code here
}
</script>
</body>
</html>


Completed 1 of 2
Add the data to be saved
The code is correct
___

Create a free account to access the full topic