JSFiddle - React, Tailwind, and code Playground

HTML

<div id="sample">
  <h3>headline 1</h3>
  <h3>headline 2</h3>
  <h3>headline 3</h3>
</div>

JavaScript

$("h3").click(function(event){
  alert( $(this).index() + 1);
});