JSFiddle - React, Tailwind, and code Playground
HTML
<div class=test data-bar=foo></div>
JavaScript
$.fn.foobar = function() {
this.each(function() {
var t = $(this);
console.log(t);
var foo = t.data("bar");
console.log(t);
});
};
$(".test").foobar();