JSFiddle - React, Tailwind, and code Playground
HTML
<div id="containerDrag">
<div id="drag" class="draggable current" data-X="40.2" data-Y="50.4" >
</div>
</div>
</div>
CSS
.current{
height: 100px;
width: 200px;
background: red;
position:relative;
top:10px;
left:10px;
}
JavaScript
var dragDown = true;
$(window).on('mouseup', function(){
if (dragDown){
var oX = $(".current").attr("data-X");
var oY = $(".current").attr("data-Y");
console.log("oXY: "+oX+", "+oY); //<--- works fine
// $(".current").css("top", oX + "px"); //<--- does not work
//$(".current").css("left", oY + "px");
console.log("up: "+$(".current").css("top")+", "+$(".current").css("left"));
$(".current").css({"top":oX + "px" , "left":oY + "px"});
}
dragDown = false;
});