Here we want to drop the red square into the blue square. But, when you try to drop it there, it jumps back to where it was before. Make use of the function handleDrop to join the two elements together. You pass the challenge if you drop the red square into the blue one and it stays there.

HTML snippet

<div id="dragItem" draggable="true"/>
<div id="dropArea"/>

JavaScript snippet

const dragItem = document.getElementById('dragItem');
const dropArea = document.getElementById('dropArea');

dragItem.addEventListener('dragstart', (e) => {
 // your code here
 
});

dropArea.addEventListener('dragover', (e) => {
  // your code here
 
});

dropArea.addEventListener('drop', handleDrop);

function handleDrop(e) {
	// The logic of performing the drop function here
  e.preventDefault();
  
 
}

Preview

20250417-1005-05.4511230.mp4