JSFiddle - React, Tailwind, and code Playground
by rwaldron
HTML
<div id="the-div"></div>
JavaScript
var clone;
$("#the-div").data("stuff", {"field1":"1", "field2":"2"});
// Does not clone data
clone = $("#the-div").clone();
console.log(typeof clone.data("stuff") === "undefined"); // true
// Explicitly clone the element's data
clone = $("#the-div").clone(true);
console.log(typeof clone.data("stuff") === "object"); // true