JSFiddle - React, Tailwind, and code Playground
by OliverJAsh2
HTML
<div id="drag" draggable="true">drag me</div>
<hr>
<div id="drop">
drop here
<p>child</p>
parent
</div>
CSS
.red {
background-color: red;
}
JavaScript
const dropEl = $('#drop');
dropEl.bind({
dragenter: function() {
$(this).addClass('red');
},
dragleave: function(e) {
console.log(dropEl.contains(e.target))
$(this).removeClass('red');
}
});
$('#drag').bind({
dragstart: function(e) {
e.allowedEffect = "copy";
e.setData("text/plain", "test");
}
});