JSFiddle - React, Tailwind, and code Playground

by rwaldron

HTML

<div id="testdiv"></div>

JavaScript

$('#testdiv').data('other', 'othervalue');


console.log(
// jQuery _does_not_ create data-* attributes with data() 
// there is no "other"
$('#testdiv')[0].dataset 
    
);

$('#testdiv').removeData(['val', 'other']);

$('#testdiv').append($('#testdiv').data('other'));