JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test_4">
<button id="button">Get ID</button>
</div>
JavaScript
$('#button').click(function() {
parentID = $(this).parent().attr('id').match(/\d+/);
alert(parentID);
});