JSFiddle - React, Tailwind, and code Playground

HTML

<div data-name="Jacob" data-age="21"></div>

JavaScript

data = $("div").data();

for(var i in data){
    console.log(i); // age and name will be returned
}

console.log(data.age); // you can then use the attributes from before