JSFiddle - React, Tailwind, and code Playground

HTML

<section>
    <a href="#">test 1</a>
</section>

<section>
    <a href="#">test 2</a>
</section>

<section>
    <a href="#">test 3</a>
</section>

JavaScript

var links = $('section a').on('click', function() {
    alert(links.index(this));
});