JSFiddle - React, Tailwind, and code Playground
HTML
<div class="drag"></div>
<div class="match"></div>
CSS
.drag{
width:20px;
height:20px;
background:#0000ff;
}
.match{
width:100px;
height:100px;
background:#ff0000;
}
JavaScript
$(function () {
var play = [];
function make_drop_fn(i) {
return function (event, ui) {
alert(play[i]);
}
}
$('.drag').draggable();
for (var i = 0; i < 3; i++) {
play[i] = i;
alert(play[i]);
$('.match').droppable({
greedy: true,
drop: make_drop_fn(i)
});
}
});