JSFiddle - React, Tailwind, and code Playground
HTML
<div id="1">
<div>
<button onclick="teste('#s', this);">Pronto</button>
</div>
</div>
<div id='s'></div>
JavaScript
function teste($x, self) {
$el = $(self).closest('[id]').attr('id');
$($x).html($el);
}