JSFiddle - React, Tailwind, and code Playground
HTML
<div class="level1" data-attr="Level 1">Level 1
<div class="level2" data-attr="Level 2">Level 2
<div class="level3" data-attr="Level 3">Level 3
<div id="starthere">HERE!</div>
</div>
</div>
<div class="level2" data-attr="Level 2">Level 2</div>
</div>
JavaScript
jQuery.expr.match.closest = /^:(?:closest)$/;
jQuery.expr.find.closest = function (match, context, isXML) {
console.log("jQuery.expr.find.closest");
};
alert($('#starthere:closest(div)').data('attr'));