JSFiddle - React, Tailwind, and code Playground

by Newton Anbarasu

HTML

<div id='A' class='x'>HELLO</div>


<div id='B' class='x'>WORLD</div>

JavaScript

$(document).ready(function()
{

var td1 = $("#A");
var td2 = $("#B");

td1.draggable({
    cursor: "move",
    appendTo: "body",
    helper: "clone",
    opacity: "0.5",
    revert: "invalid"
    
});

td2.droppable({
    accept: 'div',  
    drop: function (event, ui) {
            
        var x = $(ui.draggable).html();
      
        $(this).html(x);

    }
});
    
    
});