JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://d3js.org/d3.v3.min.js"></script>

JavaScript

var drag = d3.behavior.drag()
.on("drag", function(d) {
    console.log(this);
    var coords = d3.mouse(this);
    console.log(coords);
	d3.select(this)
        .style("right", coords[0] + "px")
	    .style("left", coords[0]  + "px")
	    .style("top", coords[1] + "px")
        .call(function(){console.log(coords)});
});

var div = d3.select("body")
    .append("div")
    .style("position", "absolute")
    .style("left", "100px")
    .style("top", "50px")
    .call(drag);

div
    .append("table")
    .append("th")
    .text("Drag me")
    .style("background-color", "tomato");