JSFiddle - React, Tailwind, and code Playground
HTML
<p class="test" data-id=1>Some Value</p>
<p class="test" data-id=2>Some Value</p>
<p class="test" data-id=3>Some Value</p>
<p class="test" data-id=4>Some Value</p>
JavaScript
alert($( "p[data-id='1']" ).html());