JSFiddle - React, Tailwind, and code Playground
HTML
<div id="data" data-color="black" data-id="1">Nice DIV</div>
<pre id="response"></pre>
JavaScript
firstData = JSON.stringify($("#data").data());
firstDataset = JSON.stringify($("#data").get(0).dataset); $("#response").html(".data():\n" + firstData + "\n\n");
$("#response").append(".dataset:\n" + firstDataset + "\n\n");
$("#data").attr("data-user","John");
$("#response").append("We set the attr data-user to John\n\n");
lastData = JSON.stringify($("#data").data());
lastDataset = JSON.stringify($("#data").get(0).dataset);
$("#response").append(".data():\n" + lastData + "\n\n");
$("#response").append(".dataset:\n" + lastDataset + "\n\n");